目次
敵がついてくる範囲の設定
NavMeshAgentの追加と設定
敵が主人公を追いかけるスクリプトの作成
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class EnemyFollowPlayer : MonoBehaviour { public GameObject target; NavMeshAgent agent; // Use this for initialization void Start () { agent = GetComponent<NavMeshAgent>(); } // Update is called once per frame void Update () { agent.destination = target.transform.position; } }
コメント
コメント一覧 (1件)
[…] 接近してくる敵(NavMeshAgent) […]