2dkot
1
I want to get access to object, which was instantiated from prefab. Problem is that there are a lot of such objects with same name. So I decided, that it is better way to instantiate prefab by object with unique name. I try this way:
var bigStone01:GameObject = stone.getBigStone01();
var bigStone02:GameObject = stone.getBigStone02();
cloneStone01.Instantiate(bigStone01, pos01, getSimpleTerrainRotY(pos01));
cloneStone01.name = "1212121" + i;
In this case all “cloneStone01” do not appears in scene, if I remove line “cloneStone01.name = “1212121” + i;”, “cloneStone01” appears again.
This is a link from my previous question which cause this situation.
[Unknown identifier: 'Instantiate' - weird behavior. - Questions & Answers - Unity Discussions][1]
[1]: Unknown identifier: 'Instantiate' - weird behavior. - Questions & Answers - Unity Discussions
kevork
2
Instantiate returns the GameObject created.
Try changing:
cloneStone01.Instantiate(bigStone01, pos01, getSimpleTerrainRotY(pos01));
To:
cloneStone01 = Instantiate(bigStone01, pos01, getSimpleTerrainRotY(pos01));