Hello my fellow developers,
I’ve got a problem using GetComponent in a StateMachineBehaviour, probably because it doesn’t inherited from MonoBehaviour, but I don’t know how to fix this. This is my code, I did put a $ at the start of every line which doesn’t work.
using UnityEngine;
using System.Collections;
public class SetIdleScript : StateMachineBehaviour {
$ private GameManager GameManager;
$ private void Awake(){
$ GameManager = GetComponent<GameManager>();
$ }
override public void OnStateEnter(Animator Anim, AnimatorStateInfo stateInfo, int layerIndex)
{
Anim.SetBool("IsIdle", true);
$ GameManager.RoundStart();
}
}