示例#1
0
        public GameObject GetObject(Transform parent)
        {
            sleepTimerTicker  = DisposeTime;
            disposeTimeTicker = AssetTrackMgr.DISPOSE_CHECK_INTERVAL;

            if (objectList.Count > 0)
            {
                var gameObject = objectList.Last.Value;
                objectList.RemoveLast();
                gameObject.SetActive(true);
                if (null != parent)
                {
                    gameObject.transform.SetParent(parent, false);
                }
                return(gameObject);
            }
            else
            {
                var gameObject = assetTrackMgr.instantiateAction(prefab) as GameObject;
                //gameObject.name = path;
                gameObject.name = prefab.name;
                if (null != parent)
                {
                    gameObject.transform.SetParent(parent, false);
                }
                gameObject.transform.localPosition = prefab.transform.localPosition;
                gameObject.transform.localRotation = prefab.transform.localRotation;
                gameObject.transform.localScale    = prefab.transform.localScale;
                refCount++;
                return(gameObject);
            }
        }