Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created November 4, 2013 13:47
Show Gist options
  • Save tsubaki/7302683 to your computer and use it in GitHub Desktop.
Save tsubaki/7302683 to your computer and use it in GitHub Desktop.
UnityのNavmeshでターゲット方向へ移動する例
using UnityEngine;
public class MoveToTarget : MonoBehaviour {
public Transform target;
NavMeshAgent agent;
void Start () {
agent = GetComponent<NavMeshAgent>();
}
void Update () {
agent.SetDestination(target.position);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment