public bool Initialize() { if (!Egcb_MutableMutationsMonitor.bInitialized) { Egcb_MutableMutationsMonitor.bInitialized = true; Egcb_MutableMutationsMonitor.Instance = this; base.StartCoroutine(this.OptionMonitorLoop()); return(true); } return(false); }
static private void StartOptionsMonitor() { if (!Egcb_MutableMutationsMonitor.IsActive) { //using UnityEngine.GameObject.AddComponent is the only way that I know of to "instantiate" an instance of a //class that derives from MonoBehavior. We need MonoBehavior's Coroutine functionality to spin off a separate //"thread" to poll for the Options menu, because there is no event available in the game API for a mod to hook into. Egcb_MutableMutations.monitorObject = new UnityEngine.GameObject(); Egcb_MutableMutationsMonitor taskManager = monitorObject.AddComponent <Egcb_MutableMutationsMonitor>(); taskManager.Initialize(); } return; }