Type Function Return value none Revision 2017.3060 Keywords ads, advertising, Unity Ads, show See also unityads.isLoaded() unityads.*
Shows a Unity Ads video interstitial or rewarded video ad.
Once you initialize the plugin with unityads.init(), Unity Ads will automatically start loading ads for the placement IDs you've configured in the Unity Ads dashboard.
unityads.show( placementId )
local unityads = require( "plugin.unityads" )
-- Unity Ads listener function
local function adListener( event )
if ( event.phase == "init" ) then -- Successful initialization
print( event.provider )
end
end
-- Initialize the Unity Ads plugin
unityads.init( adListener, { gameId="YOUR_UNITYADS_GAME_ID" } )
-- Sometime later, show an ad
if ( unityads.isLoaded( "YOUR_UNITYADS_PLACEMENT_ID" ) ) then
unityads.show( "YOUR_UNITYADS_PLACEMENT_ID" )
end