Dear All
kindly I use the method Instantiate to create a number of buttons, and each button has a 3D Text with the name “caption”.
What I need to do is to change the text in the 3D Text
but I cant because all of the buttons have the same name.
I need to know if there is a way to rename the object with a unique name once it created??? so we can use the name as a reference to locate and modify the text.
var go : GameObject = Instantiate(whatever);
go.name = "Foo1";
Really, you should be holding references to these in an array instead of searching for them by name every time you want to access them - that’s really slow.
var objects : GameObject[];
var count : int=5;
function Start() {
objects = new GameObject[count];
for (x=0;x<count;x++) {
objects[x] = Instantiate(whatever);
}
}
then you can access each item with objects[somenumber]