void Start(){
pooledObjects = new List();
for (int i = 0; i < pooledAmount; i++)
{
GameObject obj = (GameObject)Instantiate(pooledObjects);
obj.SetActive(false);
pooledObjects.Add(obj);
}
}
My Error: says like Systems.Collection.GenericSystem.Collections.Generic.List’ must be convertible to UnityEngine.Object in order to use it as parameter `T’ in the generic type or method
In this line of code, you tried to instantiate the actual list of pooled objects, versus instantiating a Unity GameObject:
GameObject obj = (GameObject)Instantiate(pooledObjects);
You can only call Instantiate on a Unity GameObject. Therefore, your code should look something like this:
void Start(){ pooledObjects = new List();
for (int i = 0; i < pooledAmount; i++)
{
GameObject obj = (GameObject)Instantiate(pooledObjects*);*
obj.SetActive(false);
pooledObjects.Add(obj);
}
}