protected virtual void OnEnable() { if (OnEnabled != null) { OnEnabled.Invoke(); } }
protected virtual void OnEnable() { try { if (Unloaded) { return; } if (!Initialized) { OnInitialize(); } OnEnabled.RaiseEvent(null, null); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
private void OnEnable() { #if UNITY_EDITOR && LOG_RELOAD_TIME Debug.Log($"*** reloaded in {EditorApplication.timeSinceStartup - startReloadTime}s ***"); #endif InitStates(); Application.wantsToQuit += WantsToQuit; // todo: callback signature same for each platform? Application.lowMemory += () => { OnLowInMemory?.Invoke(); }; #if UNITY_EDITOR EditorApplication.update += EditorAppUpdateCallback; SceneView.onSceneGUIDelegate += HandleOnSceneGUI; #endif OnEnabled?.Invoke(); }
private void OnEnable() => OnEnabled?.Invoke();
/// <summary> /// Retrieve the next item from the pool to be used /// </summary> /// <param="item">Pass out a reference to the item to be used. Null if this returns false</param> /// <returns>Returns true if there was an item that could be used, otherwise false</returns> public bool GetNextItem(out T item) { // Check if an existing item can be retrieved item = null; bool cleanedOut = false; do { // Can re-use an item if (AliveObjects < itemPool.Count) { if (itemPool[AliveObjects] != null) { item = itemPool[AliveObjects]; } // Remove the null entry and let it try again else { itemPool.RemoveAt(AliveObjects); } } // Need to create a new item else if (PoolLimit < 0 || itemPool.Count < PoolLimit) { item = onCreateItem() ?? throw new NullReferenceException($"Unable to create a new item of type {nameof(T)} for the pool"); itemPool.Add(item); } // Check if the items have had any null entries cleaned out else if (!cleanedOut) { // Clean out any null entries to see if there is any room left that can be found cleanedOut = true; for (int i = itemPool.Count; i >= 0; --i) { if (itemPool[i] == null) { itemPool.RemoveAt(i); } } } // Nothing to be done, out of items else { break; } } while (item == null); // If there is an item, do final setup if (item != null) { OnEnabled?.Invoke(item); ++AliveObjects; return(true); } else { Debug.LogError($"Unable to create a new pool entry for use. The pool has reached the maximum size of {PoolLimit}"); return(false); } }
/// <summary> /// Enables firewall. /// </summary> public virtual void Enable() { _mEnabled = true; OnEnabled?.Invoke(); }
private void OnEnable() { OnEnabled?.Invoke(); }
public static void Postfix(VRPointer __instance) => OnEnabled?.Invoke(__instance);
public void PowerUpEnable(Motor motor) { Enable(motor); OnEnabled?.Invoke(); }
protected virtual void OnEnable() { OnEnabled?.Dispatch(); }
private void OnEnable() { Spawn(); OnEnabled?.Invoke(this, EventArgs.Empty); }