Quick answer: Keep heavy work off the main thread so it doesn't block, guard against infinite loops and deadlocks, and capture freezes to find their cause. A freeze hangs the game while it's technically still running.
A freeze, the game hanging and becoming unresponsive while technically still running, frustrates players as much as a crash. Freezes come from the game getting stuck, which has specific causes you can prevent. Here's how to prevent freezes in your game.
Keep Heavy Work Off the Main Thread
A common freeze cause is heavy work blocking the main thread, a long computation, a synchronous load, a slow operation, that stops the game from updating and rendering until it finishes, appearing as a freeze. So keep heavy work off the main thread: do long operations asynchronously or in the background so the game stays responsive.
Bugnet captures context, so you can understand what the game was doing during a freeze. Keeping heavy work off the main thread prevents the freezes that come from blocking it, since the main thread is what keeps the game responsive, and anything that stalls it freezes the game.
Guard Against Infinite Loops and Deadlocks
Freezes also come from the game getting stuck in an infinite loop or a deadlock, execution that never completes or two things waiting on each other forever. So guard against these: be careful with loop conditions and locking, since an infinite loop or deadlock hangs the game indefinitely, a freeze that never resolves on its own.
Bugnet captures context to help you diagnose where the game hangs. Guarding against infinite loops and deadlocks prevents the freezes that come from execution getting permanently stuck, which are among the hardest freezes since the game never recovers.
Capture Freezes So You Can Find Their Cause
Freezes can be hard to diagnose because the game doesn't crash, it just hangs, so capture freeze information from the field, what the game was doing when it stopped responding. Seeing the context around a freeze points you at the cause, the blocking operation, the loop, the deadlock, so you can prevent it.
Bugnet captures crashes and context from the field, helping you diagnose hangs and freezes. So prevent freezes in your game by keeping heavy work off the main thread, guarding against infinite loops and deadlocks, and capturing freezes to find their cause, addressing the specific causes of the game getting stuck.
Keep heavy work off the main thread so it doesn't block, guard against infinite loops and deadlocks, and capture freezes to find their cause. A freeze hangs the game while it's technically still running.