Hello!
I have this script that changes a variable in an array of objects.
How can I set the rigidbody and collider of these objects to false as well?
var barricades = GameObject.FindGameObjectsWithTag("Bar");
for(var x in barricades)
{
var theScript = x.GetComponent.< Js_Bars >();
theScript.hitted = true;
}
For the rigidbody you should be able to add the following code
if (x.rigidbody!=null){
x.rigidbody.active = false;
// For unity 4
x.rigidbody.detectionCollisions = false;
}
See
http://docs.unity3d.com/Documentation/ScriptReference/GameObject-rigidbody.html
Warning the above code was just added here. Might be a typo or 10