Skip to content

Instantly share code, notes, and snippets.

Created Jul 2, 2015
What would you like to do?
using UnityEngine;
[RequireComponent(typeof(NavMeshAgent), typeof(Animator))]
public class Move : MonoBehaviour
[SerializeField, HideInInspector] NavMeshAgent agent;
[SerializeField, HideInInspector] Animator animator;
void Reset()
agent = GetComponent<NavMeshAgent>();
animator = GetComponent<Animator>();
void Update ()
animator.SetFloat("Speed", agent.velocity.sqrMagnitude);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment