Exemple #1
0
 void Awake()
 {
     if (Pooler.Instance != null)
     {
         Debug.LogError("Pooler already initialized");
     }
     else if (Pooler.Instance == null)
     {
         Pooler.Instance = this;
         initlializePooler();
     }
 }
Exemple #2
0
        void Update()
        {
            if (this.gameObject.activeInHierarchy)
            {
                this.time += Time.deltaTime;

                if (this.time > this.lifetime)
                {
                    Pooler.returnObjectToPool(this.gameObject);
                    this.time = 0f;
                }
            }
        }