Problem when toggling canMove boolean

I made a script that sets canMove to false, and then moves the AI GameObject.
After a set amount of time, canMove is set back to true, then the AI GameObject ‘jumps’ back to the location it was before canMove was set to false.
Any idea as to what is causing the AI to jump and how I can fix it?
Thank you!

By a lucky guess, i stopped the AI GameObject from jumping back by disabling and re-enabling its character controller right before setting canMove back to true.
I don’t understand why this worked or what exactly was going on in the first place.
Any ideas?

Can you post your script:

I’ve written two different scripts that are interacting with the AI pathfinding together. Together they’re over 200 lines of code, most of which I’m 99% sure isn’t causing the problem.
So here’s a synopsis of what i’m doing.

I have an event that calls…
GetComponent(AIPath).canMove = false;
setting a timer for 5 seconds
and setting ‘push’ to true

Then in function update
if push == true
rigidbody.MovePosition(rigidbody.position + Vector3(X, 0, 0));

every update X is decreased until it reaches 0.0

if X == 0.0 & 5 second timer has finished counting down
GetComponent(AIPath).canMove = true;

this is where the AI GameObject teleports back.
I don’t know programmatically what’s happening, but it seems as if the current position of the AI GameObject is being tracked every update by AIPath, and is being told go from ‘current position’ to ‘new position’. When canMove is turned false it stops tracking ‘current position’ then when canMove is turned to true again, the last known ‘current position’ is used so it teleports the AI GameObject to that position so it can move from there to the ‘new position’ that was also stored earlier.
For whatever reason, disabling and enabling the character controller resets its ‘current position’

That’s a guess… I really don’t know what it’s doing.

Sorry for the late answer.

Are you using local avoidance in this project?
There is a bug which was fixed in the beta which would cause issues similar to the ones you are describing.

I was only using a simple smooth modifier.

That’s weird, because the AIPath script doesn’t store the position of the agent.
So no other scripts used?

The Seeker script.
Maybe the Character Controller stores something?
I removed the Character Controller toggle and it works fine, so I must have fixed the problem elsewhere without realizing it.
I have no idea… It’s all good though, it’s working.