public Enumerator(Scene scene) { if (scene.IsValid() == false) { throw new ArgumentException($"{nameof(scene)} is not valid!"); } if (Application.isPlaying == false && scene.isLoaded == false) { throw new ArgumentException("The scene is not loaded."); } _index = -1; _internalList = ObjectListPool.Rent(); if (scene.rootCount == 0) { return; } if (_internalList.Capacity < scene.rootCount) { _internalList.Capacity = scene.rootCount; } SceneUtilities.GetRootGameObjects(scene.handle, _internalList); }
public void Dispose() { if (_buffer != null) { ObjectListPool.Return(_buffer); _buffer = null; } }
public void Dispose() { if (_internalList == null) { return; } ObjectListPool.Return(_internalList); _internalList = null; }
public Enumerator(GameObject gameObject, bool recursive, bool includeInactive, bool reverse) { if (gameObject == null) { throw new ArgumentNullException(nameof(gameObject)); } _internalList = ObjectListPool.Rent(); GetComponentUtilities.GetComponents(gameObject, Type, false, recursive, includeInactive, reverse, _internalList); _index = -1; }
public static void SetComponentsInChildrenEnabledState <T>(this GameObject gameObject, bool enabled, bool includeInactive = true) where T : Behaviour { var internalList = ObjectListPool.Rent(); GetComponentUtilities.GetComponents(gameObject, typeof(T), false, true, includeInactive, false, internalList); var count = internalList.Count; for (int i = 0; i < count; i++) { var behaviour = Unsafe.As <T>(internalList[i]); behaviour.enabled = enabled; } ObjectListPool.Return(internalList); }
internal Inserter(List <object> iterator) { _buffer = ObjectListPool.Rent(); _iterator = iterator; }