unityads.isLoaded()

Type Function
Return value Boolean
Revision Release 2026.3728
Keywords ads, advertising, Unity Ads, isLoaded
See also unityads.show()
unityads.*

Overview

Returns a boolean indicating whether an ad is loaded and ready for display.

Syntax

unityads.isLoaded( adUnitId )
adUnitId (required)

String. The ad unit ID configured in the LevelPlay dashboard.

Example

local unityads = require( "plugin.unityads.v4" )

-- Unity Ads listener function
local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )
    end
end

-- Initialize the plugin
unityads.init( adListener, { gameId="YOUR_LEVELPLAY_APP_KEY" } )

-- Sometime later, check if an ad unit ID is loaded and ready for display
print( unityads.isLoaded( "YOUR_AD_UNIT_ID" ) )