Closed justalemon closed 3 months ago
Explanation
The NativeMenu.Next()
and NativeMenu.Previous()
methods are used to navigate to the Next or Previous items in a NativeMenu
. (Note: these methods are publicly callable, so if you call one of them in this situation the game hangs as well) Two methods works the exact same way other than one moves forwards and the other one moves backwards.
The Next and Previous item logic is ran inside a while loop:
nextIndex
forwards or backwards by one - we call it cursor.This way it works fine as long as the menu have at least one valid item among all items. However, when there is a menu consisted entirely of separators, as the logic is completely unaware about the menu is entirely consisted of separators, the code will keep going back and forth between step 1 and step 2, completely blocking the "game thread" and not allowing the game engine and other scripts to execute.
Hince, the game hangs, until the script ticking the offending menu is aborted.
I'm aware of that. I just remembered to push the fix as it's already fixed on my local repo.
Tried making a menu that ended up accidentally with only separators. Turns out, the game hangs if they don't have any other item to select.