Like in question, I want to create multiple object from the same prefab in for loop. Something like this:
for(int i = 0; i < 4; i++)
{ GameObject Orb = (GameObject) Instantiate (OrbPrefab, transform.GetChild(i).position, Quaternion.identity);
//code to do something with Orb
}
But I don't know why I get this error: "Object reference not set to an instance of an object"
OrbPrefab
ortransform.GetChild(i)
that's null. You should absolutely spend a day learning how to use the debugger. Look for tutorials on using the debugger in Unity. – Byte56♦ 2 days ago