Find the transform that is child

Hey everyone, I have a question my search couldn’t answer. Hopefully my description is understandabe by you all.

Basicly, my scene is set up like this.

There are 3 planets, each with child. All of those children are named the same, the planets however are named uniquly.

What I want is, when a planet is selected (I have that code), the player becomes a child of that planet’s child. In essence, a planet grandchild :slight_smile:

I have code that assigns a GameObject variable to the selected planet. What I tried to do is this line of code

var Planet : GameObject;

transform.parent = transform.Find( (Planet.name + "/child");

I get an error though.

I’m not sure exactly what I’m setting up wrong. The transform Find script uses a String. I basically create my own ‘dymanic’ string based on what the selected (uniquely named) planet is.

Help me, Obi-Wan Kenobi. You’re my only hope.

Problem here is not about the Transform.Find() function. It is where you are writing that line in. Clearly you have a static method or something else static nearby.

Entire code would have helped us help you better.