Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | AlpacaLord |
Hi!
I’m using a Thread to place the correct terrain and objects around the player whenever he/she moves.
When I export it to IOS everything works fine until I exit my app. When the app is out of focus on my iphone it just crashes because of the thread.
I somehow need to stop the thread whenever the app is out of focus but I can’t figure out how.
This is what I already tried:
func _notification(what):
if what == MainLoop.NOTIFICATION_WM_FOCUS_OUT && OS.get_name().nocasecmp_to("windows") != 0:
threadActive = false
The threadActive is being used by a while loop in the thread to keep it going. So whenever threadActive is false the thread stops but this method doesn’t work.
I would really appreciate it if someone could help me with this!