i want a script , that should have the array variable to get the multiple gameobject as a elements and print
the mass values of rigidbody attached with the gameobjects assigned to the array variable. so far I am able to get the mass value of the child objects how do I combine it with an array system.
public void checker()
{
int children = this.transform.childCount;
for (int i = 1; i < children; ++i)
{
Rigidbody Rbd;
Rbd = this.transform.GetChild(i).gameObject.GetComponent();
float mass = Rbd.mass;
Debug.Log("mass" + mass);
}
}
↧