- Home /
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.
Answer by jandd661 · Sep 14, 2018 at 02:24 PM
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.
I did mention how i move it above by using Vector3. $$anonymous$$oveTowards :
transform.position = Vector3.$$anonymous$$oveTowards(transform.position, followXonly, _speed * Time.deltaTime);
Strange, I can't see that anywhere. Anyways, when your panel opens and before you pause the game, you need to set "followXonly" to your transforms current position.
"I did mention how i move it above by using Vector3. $$anonymous$$oveTowards "
No you dont.
Your answer
Follow this Question
Related Questions
Unable to make 2D enemy zigzag : Top Down View 1 Answer
KEEP INSTANTIATE PREFAB ONMOUSEDOWN 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers