- Home /
Question by
Rick74 · Mar 09, 2014 at 01:00 AM ·
javascriptarrayspopulate
Trying to populate an array with a GameObject
Did a search and I can only find C# examples. (I'm actually trying to follow along with this video and convert it to Java)
http://www.youtube.com/watch?v=1nm9oISSHqI&feature=youtu.be
However I had to change up a few things and I get this error on the instantiation line;
UCE0001: ';' expected. Insert a semicolon at the end.
var numberOfEnemys01: int = 20;
var enemyPrefabs01: GameObject[] = null;
function InstantiateEnemy ()
{
for (var i : int = 0; i < numberOfEnemys01; i++)
{
enemyPrefabs01[i] = Instantiate GameObject.Find("Prefabs/Enemy Prefabs/prefab alien");
enemyPrefabs01[i].SetActive(false);
}
}
Now obviously, their is a semi colon at the end of that line. So I'm out of ideas. :( Any help would be greatly appreciated.
Comment
Best Answer
Answer by mattyman174 · Mar 09, 2014 at 01:08 AM
Instantiate is a function.
enemyPrefabs01[i] = Instantiate(GameObject.Find("Prefabs/Enemy Prefabs/prefab alien"));
heh, well now that it works, I'm getting a strange error. I will post it in another question, though.