Hi there,
I’ve been having a little problem,
I’m creating a script to help open doors, but first I need to get a couple of AnimationClips, each one containing a specific word(In this case “Open” and “Close”), however I’m having trouble.
The if() statements in my script only seem to be accessing whichever AnimationClip is in the part that is highlighted Red in the inspector but I need it to get my AnimationClips that are highlighted Yellow in the inspector.
I’m sure that I’m missing something really simple.
Anyway, even the slightest bit of help would be greatly appreciated.
Thanks In advance.
public class DoorScript : MonoBehaviour
{
GameObject Door;
public AnimationClip OpenAnimation;
public AnimationClip CloseAnimation;
void Start()
{
Door=gameObject;
if(Door.GetComponent<Animation>().name.Contains("Open"))
{
Debug.Log("FoundOpen");
}
if(Door.GetComponent<Animation>().name.Contains("Close"))
{
Debug.Log("FoundClose");
}
}
}