private void Update()
{
var token = new CancellationTokenSource();
}
private void Update()
{
var token = new CancellationTokenSource();
}
var uniTask = Func?.Invoke(_tokenSource.Token);
await uniTask.GetValueOrDefault();
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
StopCoroutine(findPath());
}
}
private void OnTriggerExit(Collider other)
{
if (other.tag == "Player")
{
StartCoroutine(findPath());
}
}
IEnumerator findPath()
{
while(true)
{
if(player != null)
{
agent.SetDestination(player.position);
yield return new WaitForSeconds(0.5f);
}
else break;
}
}