i have this script to play an animation in the characters children. when you click space the character will reach up and grab a sword on his back. this is my script:
function update()
{
if(Input.GetButtonDown("Jump"))
{
var animationComp : Animation[] = gameObject.GetComponentsInChildren(Animation);
for (var animComp : Animation in animationComp)
{
animComp.Play("grab sword");
}
}
}
when i click space i get this error: InvalidCastException: Cannot cast from source type to destination type.walker.Update () (at Assets\my scripts\walker.js:21) how do i fix that?