|
Hey guys, I know, that this is probably pretty easy, but I wanna code it fast and my brain is kinda slow tonight. So, I have an object, that has around 10 children and a few of them have other children and a few of the other children of the children have more children. Simply, it goes like 4 levels downwards. I made this
var mat : Material;
function Start () {
for (var child : Transform in transform) {
child.renderer.material = mat;
}
}
but it only changes the material of the first level children. I hope that you got what I want :)
(comments are locked)
|
The question has been closed Oct 03 '11 at 05:08 PM by Dávid Debnár for the following reason:
The question is answered, right answer was accepted
|
This is sort of pseudo-codish.. but it's the right idea.. You need to recurse. Then call setMaterial on your top level transform with the material you want.
(comments are locked)
|
|
Simple solution would be to just attach the script to the childs. Maybe.
(comments are locked)
|
