I followed some tutorials to add WASD movement to a character; I managed to set up the animator thing and it works in the bottom right corner viewport.
Next I tried adding the following C# script with basic movements:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AppleInput : MonoBehaviour
{
private Animator animator;
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
animator.SetFloat("Horizontal", Input.GetAxis("Horizontal"));
animator.SetFloat("Vertical", Input.GetAxis("Vertical"));
}
}
Configured like so:
But then I get the error message:
MissingComponentException: There is no 'Animator' attached to the "action10Prob_normalsDONEyet" game object, but a script is trying to access it.
You probably need to add a Animator to the game object "action10Prob_normalsDONEyet". Or your script needs to check if the component is attached before using it.
How do I solve this error?