- Home /
Animation clip does not exist?
I'm trying to make a door that opens upon getting near it and hitting a key. That's done. But it tells me the following when I try to run it:
The animation state Open could not be played because it couldn't be found! Please attach an animation clip with the name 'Open' or call this function only for existing animations. UnityEngine.Animation:Play(String) DoorOpen:Update() (at Assets/Scripts/DoorOpen.js:11)
In case it helps, here's the script:
var open : boolean;
var target : GameObject;
var Door : Animation;
function Update () {
if (Input.GetKeyDown("e")){
var distance = Vector3.Distance(target.transform.position, transform.position);
//Debug.Log(distance);
if (distance < 3){
if (open == false){
Door.Play("Open");
Debug.Log("Opened");
open = true;
}else{
}
}
}
}
I have no idea why. I have two animations defined (Idle and Open) and Idle is the default. When I tried it with Open as default, Auto off, and just Play();, it says there is no default. HELP!
Answer by YoungDeveloper · Dec 15, 2013 at 05:21 AM
You defined Animation as separate variable, and you must attach it in inspector. If the animations are on door itself, you can use
animation.Play("Open");
But I've defined Door as an Animation. It goes right to it.
Your answer
Follow this Question
Related Questions
Trigger door animation with external trigger 1 Answer
Door Movement Animation 3 Answers
Animate Doors and Button Through Script 1 Answer
Need help with my animation script 2 Answers
Respawn script and door animation help 0 Answers