I’ve made a sprite, made an animation and attached it. However, on attempting to create a script and make a variable that holds the animator, it doesn’t work.
When I try:
Animator animator = gameObject.GetComponent<Animator>();
it gives me the error “GetComponent requires that the requested component ‘Animator’ derives from MonoBehaviour or Component or is an interface.”
If I try:
public Animator animator;
when returning to the inspector and attempting to drag the component on, nothing happens. The animation is working fine, it just won’t attach to my script.
Thanks in advance!