How to stop a calling function

Hi, i have a problem with stopping a calling function. I have a function to make my player moves forward the mouse click position. The idea is that every time I set the panel active (open it), the player stops moving until i close the panel. But after that, he still moves to point i clicked before i open the panel. I just want to know how to make my player to stay where he is after the panel is close.

How are you moving your player? This is difficult answer without seeing how you are moving. The generic answer would be to check if the panel is active/enabled. If it is, set your player’s destination Vector3 to it’s current Vector3.