using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [ModTitle("ItemSpawner")] [ModDescription("ItemSpawner allows you to spawn items, animals or landmarks with a nice Menu.")] [ModAuthor("TeKGameR95")] [ModIconUrl("https://i.imgur.com/9nCDSCr.jpg")] [ModWallpaperUrl("https://i.imgur.com/1IaqMIx.jpg")] [ModVersionCheckUrl("https://raftmodding.com/api/v1/mods/itemspawner/version.txt")] [ModVersion("4.5")] [RaftVersion("Update 10.05")] public class ItemSpawner : Mod { private IEnumerator Start() { if (GameObject.Find("ItemSpawnerMenuCanvas")) { Destroy(GameObject.Find("ItemSpawnerMenuCanvas")); } using (UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle("https://www.raftmodding.com/TeKGameRMods/assets/itemspawner.assets")) { yield return uwr.SendWebRequest(); if (uwr.isNetworkError || uwr.isHttpError) { RConsole.LogError("An error occured while downloading ItemSpawner assets!\n" + uwr.error); yield break; } else { asset = DownloadHandlerAssetBundle.GetContent(uwr); } } itemSpawner = Instantiate(asset.LoadAsset("ItemSpawnerMenuCanvas"), Vector3.zero, Quaternion.identity); DontDestroyOnLoad(itemSpawner); itemSpawner.transform.Find("Background").Find("GiveWindow").Find("GiveBtn").GetComponent