Hi, this may seem like an easy thing to do, but I basically want to toggle an animation speed through a script attached to an empty gameobject.
So, here is what I have:
1 Object (“Camera_Animation”)
1 Animation Clip (“Take 001”)
I can script it fine if I attach the script to the object and use animation[“Take 001”].speed = 0;
My problem is when I want to attach the script to another gameobject. I’m not sure of the syntax needed to store “Take 001” in a variable to be called up on its own.
This is what I have, but it doesn’t work
var AnimObject : GameObject;
function Update () {
if (Input.GetKeyDown ("m")) {
AnimObject.animation["Take 001"].speed = 0;
}
}
Thanks