- Home /
Sprite animation don't work in script
Hi there. At the beginning I wanted to apologize for the grammatical errors but I'm Polish and I can not speak great English. I have a problem in Unity. After taking animation and assigning it, it still does not work. I've read many topics but none helped me. I set the in Debug tab, "Animation Type = 1" .I will send the code. It's simple.
using UnityEngine;
using System.Collections;
public class PlayerDeadAnim : MonoBehaviour
{
void OnTriggerEnter (Collider other)
{
Debug.Log ("I'm on Trigger Enter");
if(other.tag == "Spike")
{
Debug.Log("I'm on Spike Collider");
animation.Play("PlayerDead");
Debug.Log("Animation Work",animation);
}
}
}
I wanted the player to collision with spikes play animation player's death. The script runs but the animation does not play. Debug returns the correct value. What wrong?
Comment