追いかけてくる敵の作成
追いかけてくる敵
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.AI;
public class Chase : MonoBehaviour
{
public GameObject target;
private NavMeshAgent agent;
void Start()
{
agent = GetComponent<NavMeshAgent>();
}
void Update()
{
agent.destination = target.transform.position;
}
}
【2020版】BallGame(全27回)
他のコースを見る追いかけてくる敵
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.AI;
public class Chase : MonoBehaviour
{
public GameObject target;
private NavMeshAgent agent;
void Start()
{
agent = GetComponent<NavMeshAgent>();
}
void Update()
{
agent.destination = target.transform.position;
}
}
追いかけてくる敵の作成