- Home /
Get all child not working?
Hi, For some reasons I can't get this to work properly.. can someone explain to me why it isn't working, in JS? function Start()
{
for (var child : Transform in transform)
{
child.rigidbody.isKinematic = true;
child.collider.enabled = false;
}
}
thanks!
Hi there, when you post "I can't get this to work properly", you can't assume that the readers understand what you mean by that. What precisely is not "working properly"? What are the symptoms/experiences?
Answer by Tseng · Apr 17, 2012 at 02:00 PM
That's probably because your code only lists direct children, not children of children.
You may want to use GetComponentsInChildren(Rigidbody)
get get all Rigidbody components in any of the childs
Your answer
Follow this Question
Related Questions
Parent rigidbody using its childrens colliders. Should it work or am I stupid? 2 Answers
Can a object without a rigidbody be triggered by a trigger? 1 Answer
Unity creating static colliders 1 Answer
Trouble with RayCast, rigid body and the colliders tag 0 Answers
How to get collision point when using onTriggerEnter 5 Answers