I am making a script that starts an animation at a random spot in the animation cycle. My current Code is:
function Start ()
{
animation ["Take 001"].time = Random.Range (0, animation ["Take 001"].length);
animation ["Take 001"].speed = Random.Range (0.21, 1.01);
animation.Play ("Take 001");
}
My problem is that I have ~30 of these objects and am still tweaking them in Maya. So I don’t want to break the prefab by attaching a script. So my solution would be to make an empty game object and make all of the prefabs children of this object then attach a script to that empty game object and apply the script to each child individually.
So how to I cycle through the children and apply the script to each one so they all get different values?