- Home /
The question is answered, right answer was accepted
How To Trigger Animation To Play In Game Mode
Hello everyone, I was hoping I could ask for help for a Pokemon-style catching game I working on. I have looked everywhere online and in help forum and couldn't find any information that could help.
What seems to be happening is the animation properly gets triggered to transition to the next animation in the Animator but not in Game mode.
I'm trying to trigger the animation in game but it only works in the Animator.
Here's what my code in the Script looks like:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class BallThrow : MonoBehaviour {
public GameObject PokeBall;
void Update() {
if (Input.GetKeyDown("t"))
{
PokeBall.GetComponent<Animator>().Play("Throw");
}
}
}
Thanks a bunch.
Is PokeBall
a gameObject co$$anonymous$$g from the Project
tab or the Hierarchy
tab?
Both I believe, I dragged it in from the Project tab and work on it from the Hierarchy tab. Is that what you mean?
Thank you for the fast reply.
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
OnMouseDrag issue, Event System 0 Answers
Multiple Cars not working 1 Answer
Victory menu is not working HELP 1 Answer
Animation Trigger is saved even if it is not used immediately. 1 Answer