Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (_buffer != null)
     {
         ObjectListPool.Return(_buffer);
         _buffer = null;
     }
 }
Exemplo n.º 3
0
 public void Dispose()
 {
     if (_internalList == null)
     {
         return;
     }
     ObjectListPool.Return(_internalList);
     _internalList = null;
 }
Exemplo n.º 4
0
        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);
    }
Exemplo n.º 6
0
 internal Inserter(List <object> iterator)
 {
     _buffer   = ObjectListPool.Rent();
     _iterator = iterator;
 }