So it’s a pretty simple problem. The script is supposed to animate a door. The prints work fine, so I know the conditional portions of the code work, it’s just not playing the animation at all.
using UnityEngine;
using System.Collections;
public class UO_Door : UsableObject {
public bool isOpen;
[System.Serializable]
public enum DoorOpeningDirection { Inward, Outward}
public DoorOpeningDirection OpeningDirection;
public override void DoInteract()
{
if (isOpen)
{
if (OpeningDirection == DoorOpeningDirection.Inward)
{
animation.Play("door_closing_outward");
print("closing");
}
else
{
animation.Play("door_closing_inward");
print("closing");
}
isOpen = false;
}
else
{
if (OpeningDirection == DoorOpeningDirection.Inward)
{
animation.Play("door_opening_inward");
print("opening");
}
else
{
animation.Play("door_opening_outward");
print("opening");
}
isOpen = true;
}
}
}
I have had a lot of issues with Unity’s animation system just not making sense. Don’t feel bad. Try to find an example of what you’re trying to do and dissect it, you’ll figure it out.