For the life of me I can’t get the setpath(null) to work properly with the AILerp script. My path continues to be in place and when I enable AILerp.canMove the player goes to the previous path first before going to the new set location. Here is a snip of my code.
if (currentScene.buildIndex == 0)
{
Debug.Log(“teleporting to outside”);
To elaborate I need to clear/reset the path that isn’t finished because of the scene transition/teleport to a new location. I’ve been poking through the code trying to find a way to do this but when the path has been generated I don’t see anything I can do to remove it. It has to finish it’s route to the destination before my movement will proceed with a new path.
I managed to get it fixed, thanks for the help! I had a piece of code somewhere else that was changing the position on me that I had forgotten about. I made a killMovement method that stops my player and clears the path. If anyone else ends up having similar issues I do this.
public void KillMovement()
{
target = new Vector3(0, 0, 0);
ai.canMove = false;
if (target != null && ai != null) ai.destination =
GameObject.FindGameObjectWithTag(“Player”).transform.position;
ai.SetPath(null);