Hi all,
I’m trying to load Facebook instant game ads as below,
-- Preload ad unit
function load_ad_unit(ad_unit_id)
print("loading ad unit...")
fbinstant.load_interstitial_ad(
ad_unit_id,
function(self, success)
if success then
print("Ad unit successfully loaded ")
else
print("Ad unit doesn't loaded ", ad_unit_id)
end
end
)
end
-- Show ad unit
function show_ad_unit(ad_unit_id)
fbinstant.show_interstitial_ad(
ad_unit_id,
function(self, success)
if success then
print("Ad unit successfully opened ", ad_unit_id)
else
print("Ad unit doesn't opened ", ad_unit_id)
end
end
)
end
function on_message(self, message_id, message, sender)
if message_id == hash("NEW_GAME") then
load_ad_unit("<ad_unit_id>")
elseif message_id == hash("ON_PRESS") then
show_ad_unit("<ad_unit_id>")
end
end
But this only works once at the beginning of the game when I press a button. For the second time it doesn’t work. So I tired to load the ad unit again and it throws ADS_TOO_MANY_INSTANCES
.
Thanks