- Home /
 
Answer by Mike 3 · Apr 12, 2011 at 07:14 PM
this should do it (should be valid in js and c#)
var currentParent = transform.parent;
while(currentParent != null)
{
    var parentRenderer = currentParent.renderer;
    if (parentRenderer != null)
    {
        //do something with parentRenderer
    }
    currentParent = currentParent.parent;
}
 
              currentParent is not stable. i made with for(var parents:Transform.... but i cannot reach the children's parents. I need to make change color of all parents,childrens...
What's the problem with it? That should change all parents when you call it (you shouldn't be storing currentParent anywhere)
when i use your code , nothing happens , that cannot see the parents
Your answer
 
             Follow this Question
Related Questions
Make a simple tree 1 Answer
How to move the parent object to a child of one of its children? 1 Answer
Separate child rotation 1 Answer
Assign parent object to target 2 Answers