public static GameObject Instantiate(string name, Vector3 position, Quaternion quat, Transform parent = null, GameObject prefab = null, bool pool = false, float max = Mathf.Infinity)
    {
        GameObject aux;

        if (!pool)
        {
            aux      = GameObject.Instantiate(prefab, position, quat, parent);
            aux.name = name;
        }
        else
        {
            aux = StaticPool.Instantiate(prefab, position, parent, max);
            aux.AddOnlyOneComponent <MultiTags>();
            aux.AddTags("pool");
        }
        return(aux);
    }
Example #2
0
 void Create()
 {
     StaticPool.Instantiate(obj, Vector3.down, gameObject.transform, 2);
     Invoke("Create", 1f);
 }
Example #3
0
 void Put()
 {
     StaticPool.Instantiate(obj, Vector3.down, gameObject.transform);
     Invoke("Put", time);
 }
Example #4
0
 void SpawnEnemy()
 {
     StaticPool.Instantiate(enemyPrefab, enemyPrefab.transform.position);
 }
Example #5
0
 void Create()
 {
     StaticPool.Instantiate(obj, Vector3.down, gameObject.transform, numberMax);
     Invoke("Put", time);
 }