How to activate an animation after the player has passed X point?

Good morning.
I want that, if the player passes a point, an animation triggers.

I already made a trigger collider, and the debug.log (“paso”) is working good, but the animations doesn’t run.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class AnimatorManager : MonoBehaviour {

	public float restartDelay;
	Animator anim;
	float restartTimer;
	public GameObject Player;
	public GameObject EndLevel;

	/*void Start ()
	{
		HasDied = false; 
	}*/

	void Update ()
	{
		if (GameObject.FindGameObjectWithTag ("Player") == null) 
		{
			
			anim.SetTrigger ("PlayerIsDead");

			restartTimer += Time.deltaTime;

			if (restartTimer >= restartDelay) 
			{
				SceneManager.LoadScene ("_scene01");
			}
		}
	}
	void OnTriggerEnter2D (Collider2D trig)
	{ 

		if (EndLevel.gameObject.tag == "Meta" && Player.gameObject.tag == "Player" )
		{
			Debug.Log ("paso");
			
			anim.SetTrigger ("PlayerWins");

			restartTimer += Time.deltaTime;

			if (restartTimer >= restartDelay) 
			{
				SceneManager.LoadScene ("_scene01");
			}


		}
	}

	void Awake ()
	{
		anim = GetComponent<Animator> ();
	}




}

Buenas tardes :wink:

Your code is ok. As long as the Animator is correctly set up, the animation should be triggering.

So: make sure that your Animator contains a trigger called “PlayerWins”, and that the trigger is added as condition for some state transition. You can preview all of this in the Animator panel, no need to launch the game to check it.

Gracias por responder.
I’ve fixed the problem, animations can’t be called inside void OnTriggerEnter.
It looks like animations will work only if they are put in void update, fixed update, etc.