I notice in the lecture we disable and enable the NavMeshAgent when setting the transform position. I’m curious if this is a better approach or not than NavMeshAgent.Warp(position.ToVector())?

1 Like

To be honest i am not 100% sure but reading up on it it seems that it adds an extra layer of complication on if that the agent cant find the position on the navmesh it will cause the null reference error.
Enabling and disabling as and when we want to takes more control.

@sampattuzzi may be able to correct me or expand on this

1 Like

Thanks for the response! Just a related question if you have the time: I’m thinking of creating a method “MoveAgent” that will handle the transform.position moving, so in future if I decide to change how this is done I can just change the method. Where would be the best place to put this whilst maintaining the dependency chart? I’m thinking of either PlayerController or Mover but not sure which.

I think Warp is also a decent solution. I wasn’t aware of it in the API when writing the code.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms