Type Function Return value none Revision Release 2026.3728 Keywords ads, advertising, Unity Ads, show See also unityads.isLoaded() unityads.*
Shows a LevelPlay interstitial or rewarded video ad. The ad must be loaded first via unityads.load() and the "loaded" event.phase received before calling this.
unityads.show( adUnitId )
String. The ad unit ID configured in the LevelPlay dashboard.
local unityads = require( "plugin.unityads.v4" )
local adUnitId = "YOUR_AD_UNIT_ID"
-- Unity Ads listener function
local function adListener( event )
if ( event.phase == "init" ) then -- Successful initialization
print( event.provider )
-- Load ad after init
unityads.load( adUnitId )
end
end
-- Initialize the plugin
unityads.init( adListener, { gameId="YOUR_LEVELPLAY_APP_KEY" } )
-- Sometime later, show the ad
if ( unityads.isLoaded( adUnitId ) ) then
unityads.show( adUnitId )
end