Here’s the code I have been using, although, honestly, I have tried a lot of variations with no luck. The code causes no errors but simply doesn’t trigger any animation.
Help!
Animator animator;
bool nSand;
void Start()
{
animator = gameObject.GetComponent<Animator>();
nSand = false;
}
void Update()
{
void OnCollisionEnter2D(Collision2D other)
{
LandonController player = other.gameObject.GetComponent<LandonController >();
if (player != null)
{
nSand = true;
animator.SetTrigger("Sand");
}
else
{
nSand = false;
animator.SetTrigger("Idle");
}
}
}