I want to use NavMesh.SamplePosition to find a point on NavMesh in order to instantiate game object. The code works with no bug for several months. But the function will go into infinite and freeze the game and also editor recently. Unity Editor freezes like going into infinite loop and Visual Studio finds out the task is stuck on NavMesh.SamplePosition. hit.position is a infinity vector so I guess the function is not started to find the position yet. As NavMesh.SamplePosition will return false if no position is found, I don't think it caused by the bad position or searching radius.
Asked
Active
Viewed 432 times
0
-
Did you try with different position, radius? – MarkSouls Jun 30 '21 at 02:27
-
Didn't try other radius. The source position is not fix. It will change every time when call. – Jacky Hon Jun 30 '21 at 05:42