Business FAQs

How do I handle ad errors so the game does not freeze?

0
(0)

Treat ‘no ad available’ as a normal outcome, not a failure: resume the game loop immediately when the SDK reports an empty result, keep your pause/resume logic independent of the ad call. When no ad is returned, the game should continue immediately.

At a glance

Fact Value Source
Ad SDKs report an empty state, not an error event no ‘error’ event
Unity WebGL calls browser JS via .jslib plugin docs.unity3d.com
Godot 4 web exports call JS via JavaScriptBridge singleton docs.godotengine.org

The rule that prevents freezes: never let the game loop wait on an ad call with no exit path. Pause your game state (timers, physics, input) right before requesting an ad, then resume it in the callback the SDK gives you for both ‘ad shown’ and ‘ad not available’ – not just on success. If the ad request comes back empty, resume immediately and continue the game as if no ad was requested.

Where does this code go in Unity or Godot?

  • Unity WebGL: the ad call itself lives in JavaScript, reached through a .jslib plugin. Your C# side should call the ad function, then immediately set a ‘waiting’ flag and resume gameplay from the callback the plugin invokes – don’t block the C# thread waiting for a return value.
  • Godot 4: use the JavaScriptBridge singleton to call the ad function and register a callback; resume the scene tree from that callback, not from a polling loop.
  • Phaser / other JS-first engines: call the ad SDK directly, pause your update loop in the request, resume it in the callback.

Design for the ’empty’ result as the common case, not an edge case: no fill happens regularly, and the game must look identical to a normal round whether an ad played or not. For example, in Playgama Ad there is no ‘error’ event; the SDK reports an empty event instead, and when no ad is returned, the game should continue immediately.

Sources

What should happen when an ad request returns no fill?

Resume the game immediately as if no ad was requested. No fill is a normal outcome, not a failure state, so gameplay should never wait on it.

Should I set a timeout around ad calls just in case?

Use the SDK’s own callback for the empty result rather than a custom timeout; a homemade timeout can race with a late callback and resume the game twice.

Last updated: 24 September 2026


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Your email address will not be published. Required fields are marked *

Games categories