Esempio n. 1
0
        public void Recycle(Object obj)
        {
            Type           type = obj.GetType();
            ComponentQueue queue;

            if (!this.dictionary.TryGetValue(type, out queue))
            {
                queue = new ComponentQueue(type.Name);

#if UNITY_EDITOR && VIEWGO
                if (queue.ViewGO != null)
                {
                    queue.ViewGO.transform.SetParent(this.ViewGO.transform);
                    queue.ViewGO.name = $"{type.Name}s";
                }
#endif
                this.dictionary.Add(type, queue);
            }

#if UNITY_EDITOR && VIEWGO
            if (obj.ViewGO != null)
            {
                obj.ViewGO.transform.SetParent(queue.ViewGO.transform);
            }
#endif
            queue.Enqueue(obj);
        }
Esempio n. 2
0
        public void Recycle(Object obj)
        {
            Type           type = obj.GetType();
            ComponentQueue queue;

            if (!this.dictionary.TryGetValue(type, out queue))
            {
                queue = new ComponentQueue(type.Name);
                this.dictionary.Add(type, queue);
            }
            queue.Enqueue(obj);
        }