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!