Hello
I’m having a little problem,
i have done
pin.activate=false ; but if a ball hits the invisible pin, the physics is still taken into consideration.
so i added a
pin.rigidbody.activate = false ( i thought it would take care of it ).
but no luck.
does anybody know how to completely disable a gameobject ?
Thank you
patricia.
i found out my mistake, i also had to deactivate all the child colliders, i thought that deactivating the parent would also deactivate the children, but it appears not to.
pin.transform.Find( “c1” ).active = false ;
pin.transform.Find( “c2” ).active = false ;
pin.transform.Find( “c3” ).active = false ;
Did the trick!
Patricia.
Don’t use find, because it is much slower. Instead use something like:
for( var t : Transform in transform ){
t.gameObject.active = false;
}
Regards,
Afonso
I don’t have much experience with the Unity API but a look at the GameObject class revealed the SetActiveRecursively method. Maybe this will do it in a cleaner way?
Hmmm I don’t recall ever seeing that… Or it is new, or I may need to start using glasses!
EDIT: And since I’m seeing it on the docs on my hard drive, its not new! 
Very nice, this setActiveRecursively function is great!
I still have a whole lot to learn with unity, but i’m still amazed i manage to make something that works with my poor knowledge of the software.
Thanks again!
Patricia.