(スクリプト)
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ChaseSwitch : MonoBehaviour { private Chase chase; private float dis; public GameObject target; private void Start() { chase = GetComponent<Chase>(); } void Update() { dis = Vector3.Distance(this.transform.position, target.transform.position); print(dis); if(dis < 15f) { chase.enabled = true; } } }