- Home /
Question by
twoface262 · Jan 16, 2012 at 06:02 AM ·
gameobjectchildrename
Renaming a child within code.
How would I rename a child of an object within a code?
Comment
Best Answer
Answer by Lo0NuhtiK · Jan 16, 2012 at 06:18 AM
Quick Example ->
var myKid : GameObject ; //drag a child here
var newKidName : String = "Whatever" ; //set new name in inspector
function Update(){
if(Input.GetKeyDown(KeyCode.I))
myKid.name = newKidName ;
}
Press key "I" and it will rename it.
Your answer
Follow this Question
Related Questions
Renaming Child Objects during Instantiate? 1 Answer
Find a specific child of a GameObject with the collision data from OnControllerColliderHit 4 Answers
how do I get reference to a parent or a child? 2 Answers
How to check parent value instead name value(more details in post) 3 Answers
Display Name Above Object 2 Answers