コード例 #1
0
ファイル: SimpleObjectPool.cs プロジェクト: yongwuhou/NCache
        private T GetInstanceSafe()
        {
            var instance = _objectInstantiator.Instantiate();

            if (instance == null)
            {
                throw new ObjectInstantiationException($"Failed to initialize {typeof(T)} instance");
            }

            instance.PoolManager = _poolManager;
            return(instance);
        }
コード例 #2
0
        public GameObject InstantiateAsOriginal()
        {
            GameObject gameObject = null;

            if (instantiator != null)
            {
                gameObject = instantiator.Instantiate(original);
            }
            else
            {
                gameObject = GameObject.Instantiate(original);
            }

            gameObject.SetActive(true);

            return(gameObject);
        }
コード例 #3
0
ファイル: Pool.cs プロジェクト: decentraland/unity-renderer
        public GameObject InstantiateAsOriginal()
        {
            Assert.IsTrue(original != null, "Original should never be null here");

            GameObject gameObject = null;

            if (instantiator != null)
            {
                gameObject = instantiator.Instantiate(original);
            }
            else
            {
                gameObject = GameObject.Instantiate(original);
            }

            gameObject.SetActive(true);

            return(gameObject);
        }