Help: NPC Animation from trigger animation back to idle animation C#
I have an NPC that has an idle animation, when it is collided with it triggers a roar animation. However, after that roar animation is done, I need it to go back to the idle animation. For now it just repeats the roar animation. I tried to implement Wrap.Mode.Once but then the NPC just plays the roar animation once and then freezes without any animation afterwards. Can anyone help me with this? Here's the script that I am using:
using UnityEngine;
using System.Collections;
public class DemonHit : MonoBehaviour {
void OnTriggerEnter() {
GetComponent<Animation>().wrapMode = WrapMode.Once;
GetComponent<Animation>().Play("Take 0015");
}
}
Answer by OctoMan · Dec 20, 2015 at 12:01 AM
If you are using the Animator just set a transition back with only (has exit time) to the Idle animation.
I'm having a hard time figuring this out effectively. I can make the transition in the animator but my NPC is still following my script and standing still afterwards.
Your answer
Follow this Question
Related Questions
Trigger the Animation #2 after Animation #1 was triggered 0 Answers
Animation + triggers + colliders doesn't work together 0 Answers
Player's collider not detecting hits from animated enemy 0 Answers
Top-down 2D - crawling script 0 Answers
How Can I put a Dialogue of each Questions in the inspector? 0 Answers