{"id":14404,"date":"2026-09-24T10:29:12","date_gmt":"2026-09-24T10:29:12","guid":{"rendered":"https:\/\/playgama.com\/blog\/?p=14404"},"modified":"2026-09-24T10:29:12","modified_gmt":"2026-09-24T10:29:12","slug":"how-do-i-handle-ad-errors-so","status":"publish","type":"post","link":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/","title":{"rendered":"How do I handle ad errors so the game does not freeze?"},"content":{"rendered":"<p><strong>Treat &#8216;no ad available&#8217; 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.<\/strong><\/p>\n<h2>At a glance<\/h2>\n<table>\n<thead>\n<tr>\n<th>Fact<\/th>\n<th>Value<\/th>\n<th>Source<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Ad SDKs report an empty state, not an error event<\/td>\n<td>no &#8216;error&#8217; event<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Unity WebGL calls browser JS via<\/td>\n<td>.jslib plugin<\/td>\n<td><a href=\"https:\/\/docs.unity3d.com\/Manual\/webgl-interactingwithbrowserscripting.html\" rel=\"nofollow noopener\" target=\"_blank\">docs.unity3d.com<\/a><\/td>\n<\/tr>\n<tr>\n<td>Godot 4 web exports call JS via<\/td>\n<td>JavaScriptBridge singleton<\/td>\n<td><a href=\"https:\/\/docs.godotengine.org\/en\/stable\/tutorials\/platform\/web\/javascript_bridge.html\" rel=\"nofollow noopener\" target=\"_blank\">docs.godotengine.org<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>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 &#8216;ad shown&#8217; and &#8216;ad not available&#8217; &#8211; not just on success. If the ad request comes back empty, resume immediately and continue the game as if no ad was requested.<\/p>\n<h2>Where does this code go in Unity or Godot?<\/h2>\n<ul>\n<li><b>Unity WebGL<\/b>: the ad call itself lives in JavaScript, reached through a <code>.jslib<\/code> plugin. Your C# side should call the ad function, then immediately set a &#8216;waiting&#8217; flag and resume gameplay from the callback the plugin invokes &#8211; don&#8217;t block the C# thread waiting for a return value.<\/li>\n<li><b>Godot 4<\/b>: use the <code>JavaScriptBridge<\/code> singleton to call the ad function and register a callback; resume the scene tree from that callback, not from a polling loop.<\/li>\n<li><b>Phaser \/ other JS-first engines<\/b>: call the ad SDK directly, pause your update loop in the request, resume it in the callback.<\/li>\n<\/ul>\n<p>Design for the &#8217;empty&#8217; 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 <a href=\"https:\/\/wiki.playgama.com\/playgama\/bridge-sdk\/getting-started\">Playgama Ad<\/a> there is no &#8216;error&#8217; event; the SDK reports an empty event instead, and when no ad is returned, the game should continue immediately.<\/p>\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/wiki.playgama.com\/playgama\/bridge-sdk\/getting-started\" rel=\"nofollow noopener\" target=\"_blank\">Playgama Bridge SDK &#8211; getting started<\/a><\/li>\n<li><a href=\"https:\/\/docs.unity3d.com\/Manual\/webgl-interactingwithbrowserscripting.html\" rel=\"nofollow noopener\" target=\"_blank\">Unity manual: interacting with browser scripting<\/a><\/li>\n<li><a href=\"https:\/\/docs.godotengine.org\/en\/stable\/tutorials\/export\/exporting_for_web.html\" rel=\"nofollow noopener\" target=\"_blank\">Godot docs: exporting for the Web<\/a><\/li>\n<li><a href=\"https:\/\/wiki.playgama.com\/playgama\/bridge-sdk-v1\/bridge-sdk\/api\/advertisement\/interstitial\" rel=\"nofollow noopener\" target=\"_blank\">Playgama wiki: Interstitial<\/a><\/li>\n<\/ul>\n<h2>Related questions<\/h2>\n<h3>What should happen when an ad request returns no fill?<\/h3>\n<p>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.<\/p>\n<h3>Should I set a timeout around ad calls just in case?<\/h3>\n<p>Use the SDK&#8217;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.<\/p>\n<p><em>Last updated: 24 September 2026<\/em><\/p>\n<p><script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"How do I handle ad errors so the game does not freeze?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"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.\"}}, {\"@type\": \"Question\", \"name\": \"What should happen when an ad request returns no fill?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"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.\"}}, {\"@type\": \"Question\", \"name\": \"Should I set a timeout around ad calls just in case?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"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.\"}}], \"datePublished\": \"2026-09-24\", \"dateModified\": \"2026-09-24\", \"inLanguage\": \"en\"}<\/script><br \/>\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@graph\": [{\"@type\": \"Organization\", \"name\": \"Playgama\", \"sameAs\": [\"https:\/\/www.wikidata.org\/wiki\/Q140768339\", \"https:\/\/playgama.com\/\"]}, {\"@type\": \"Service\", \"name\": \"Playgama Ad\", \"sameAs\": [\"https:\/\/www.wikidata.org\/wiki\/Q141382152\", \"https:\/\/playgama.com\/adv\/\"]}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Treat &#8216;no ad available&#8217; 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.<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"footnotes":""},"categories":[1318],"tags":[],"class_list":["post-14404","post","type-post","status-publish","format-standard","hentry","category-business-faqs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How do I handle ad errors so the game does not freeze?<\/title>\n<meta name=\"description\" content=\"Never block gameplay on an ad call: listen for the SDK&#039;s empty\/no-fill state, resume the game loop immediately, and keep pause logic separate from ad logic.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How do I handle ad errors so the game does not freeze?\" \/>\n<meta property=\"og:description\" content=\"Never block gameplay on an ad call: listen for the SDK&#039;s empty\/no-fill state, resume the game loop immediately, and keep pause logic separate from ad logic.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/\" \/>\n<meta property=\"og:site_name\" content=\"Playgama Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-24T10:29:12+00:00\" \/>\n<meta name=\"author\" content=\"David Sedrakyan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Sedrakyan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/\"},\"author\":{\"name\":\"David Sedrakyan\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#\\\/schema\\\/person\\\/5bbe086be334a842649a21fd6514a306\"},\"headline\":\"How do I handle ad errors so the game does not freeze?\",\"datePublished\":\"2026-09-24T10:29:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/\"},\"wordCount\":438,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#organization\"},\"articleSection\":[\"Business FAQs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/\",\"url\":\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/\",\"name\":\"How do I handle ad errors so the game does not freeze?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#website\"},\"datePublished\":\"2026-09-24T10:29:12+00:00\",\"description\":\"Never block gameplay on an ad call: listen for the SDK's empty\\\/no-fill state, resume the game loop immediately, and keep pause logic separate from ad logic.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/business-faqs\\\/how-do-i-handle-ad-errors-so\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/playgama.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How do I handle ad errors so the game does not freeze?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/playgama.com\\\/blog\\\/\",\"name\":\"Playgama Blog: \ud83c\udfae Insights, Tutorials, and Creative Inspiration for Game Development \ud83d\ude80\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/playgama.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#organization\",\"name\":\"Playgama Blog: \ud83c\udfae Insights, Tutorials, and Creative Inspiration for Game Development \ud83d\ude80\",\"url\":\"https:\\\/\\\/playgama.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/playgama.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-playgama-scaled-1.png\",\"contentUrl\":\"https:\\\/\\\/playgama.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-playgama-scaled-1.png\",\"width\":2559,\"height\":523,\"caption\":\"Playgama Blog: \ud83c\udfae Insights, Tutorials, and Creative Inspiration for Game Development \ud83d\ude80\"},\"image\":{\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/playgama.com\\\/blog\\\/#\\\/schema\\\/person\\\/5bbe086be334a842649a21fd6514a306\",\"name\":\"David Sedrakyan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e2bed5d1a64059eb5864ffa70f1520685ab58f2300835dc5191cc1173290d3c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e2bed5d1a64059eb5864ffa70f1520685ab58f2300835dc5191cc1173290d3c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e2bed5d1a64059eb5864ffa70f1520685ab58f2300835dc5191cc1173290d3c?s=96&d=mm&r=g\",\"caption\":\"David Sedrakyan\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/david-sedrakyan-77b930199\\\/\"],\"url\":\"https:\\\/\\\/playgama.com\\\/blog\\\/author\\\/david\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How do I handle ad errors so the game does not freeze?","description":"Never block gameplay on an ad call: listen for the SDK's empty\/no-fill state, resume the game loop immediately, and keep pause logic separate from ad logic.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/","og_locale":"en_US","og_type":"article","og_title":"How do I handle ad errors so the game does not freeze?","og_description":"Never block gameplay on an ad call: listen for the SDK's empty\/no-fill state, resume the game loop immediately, and keep pause logic separate from ad logic.","og_url":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/","og_site_name":"Playgama Blog","article_published_time":"2026-09-24T10:29:12+00:00","author":"David Sedrakyan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"David Sedrakyan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/#article","isPartOf":{"@id":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/"},"author":{"name":"David Sedrakyan","@id":"https:\/\/playgama.com\/blog\/#\/schema\/person\/5bbe086be334a842649a21fd6514a306"},"headline":"How do I handle ad errors so the game does not freeze?","datePublished":"2026-09-24T10:29:12+00:00","mainEntityOfPage":{"@id":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/"},"wordCount":438,"commentCount":0,"publisher":{"@id":"https:\/\/playgama.com\/blog\/#organization"},"articleSection":["Business FAQs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/","url":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/","name":"How do I handle ad errors so the game does not freeze?","isPartOf":{"@id":"https:\/\/playgama.com\/blog\/#website"},"datePublished":"2026-09-24T10:29:12+00:00","description":"Never block gameplay on an ad call: listen for the SDK's empty\/no-fill state, resume the game loop immediately, and keep pause logic separate from ad logic.","breadcrumb":{"@id":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/playgama.com\/blog\/business-faqs\/how-do-i-handle-ad-errors-so\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/playgama.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How do I handle ad errors so the game does not freeze?"}]},{"@type":"WebSite","@id":"https:\/\/playgama.com\/blog\/#website","url":"https:\/\/playgama.com\/blog\/","name":"Playgama Blog: \ud83c\udfae Insights, Tutorials, and Creative Inspiration for Game Development \ud83d\ude80","description":"","publisher":{"@id":"https:\/\/playgama.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/playgama.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/playgama.com\/blog\/#organization","name":"Playgama Blog: \ud83c\udfae Insights, Tutorials, and Creative Inspiration for Game Development \ud83d\ude80","url":"https:\/\/playgama.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/playgama.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/playgama.com\/blog\/wp-content\/uploads\/2026\/04\/cropped-playgama-scaled-1.png","contentUrl":"https:\/\/playgama.com\/blog\/wp-content\/uploads\/2026\/04\/cropped-playgama-scaled-1.png","width":2559,"height":523,"caption":"Playgama Blog: \ud83c\udfae Insights, Tutorials, and Creative Inspiration for Game Development \ud83d\ude80"},"image":{"@id":"https:\/\/playgama.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/playgama.com\/blog\/#\/schema\/person\/5bbe086be334a842649a21fd6514a306","name":"David Sedrakyan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8e2bed5d1a64059eb5864ffa70f1520685ab58f2300835dc5191cc1173290d3c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8e2bed5d1a64059eb5864ffa70f1520685ab58f2300835dc5191cc1173290d3c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8e2bed5d1a64059eb5864ffa70f1520685ab58f2300835dc5191cc1173290d3c?s=96&d=mm&r=g","caption":"David Sedrakyan"},"sameAs":["https:\/\/www.linkedin.com\/in\/david-sedrakyan-77b930199\/"],"url":"https:\/\/playgama.com\/blog\/author\/david\/"}]}},"_links":{"self":[{"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/posts\/14404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/comments?post=14404"}],"version-history":[{"count":2,"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/posts\/14404\/revisions"}],"predecessor-version":[{"id":14846,"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/posts\/14404\/revisions\/14846"}],"wp:attachment":[{"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/media?parent=14404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/categories?post=14404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/playgama.com\/blog\/wp-json\/wp\/v2\/tags?post=14404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}