public override void Initialize() { AssetPath = "file:///"; Caching.expirationDelay = 1; Caching.CleanCache(); _inst = this; if (!Directory.Exists(RustBuster2016.API.Hooks.GameDirectory + "\\RB_Data\\WorldEditor")) { Directory.CreateDirectory(RustBuster2016.API.Hooks.GameDirectory + "\\RB_Data\\WorldEditor"); } SavedObjectsPath = RustBuster2016.API.Hooks.GameDirectory + "\\RB_Data\\WorldEditor\\Objects.txt"; if (!File.Exists(SavedObjectsPath)) { File.Create(SavedObjectsPath).Dispose(); } RustBuster2016.API.Hooks.OnRustBusterClientPluginsLoaded += Loaded; RustBuster2016.API.Hooks.OnRustBusterClientChat += OnRustBusterClientChat; AssetPath = AssetPath + @RustBuster2016.API.Hooks.GameDirectory + "\\RB_Data\\WorldEditor\\myasset.unity3d"; MainHolder = new GameObject(); Handler = MainHolder.AddComponent <LoadingHandler>(); UnityEngine.Object.DontDestroyOnLoad(Handler); try { Handler.StartCoroutine(Handler.LoadAsset()); } catch (Exception ex) { RustBuster2016.API.Hooks.LogData("WorldEditor", "Exception: " + ex); } }
public void AddRPC() { if (_waitObject != null) { Object.Destroy(_waitObject); } try { Handler.StartCoroutine(Handler.LoadAsset()); } catch (Exception ex) { RustBuster2016.API.Hooks.LogData("WorldEditor", "Exception: " + ex); } _rpcBehaviour = PlayerClient.GetLocalPlayer().gameObject.AddComponent <RPCBehaviour>(); }