unityads.isLoaded()

类型 函数
返回值 布尔值
修订版 版本 2024.3703
关键词 广告、广告宣传、Unity 广告、isLoaded
另请参阅 unityads.show()
unityads.*

概述

返回一个 布尔值,指示广告是否已加载且可展示。

语法

unityads.isLoaded( placementId )
placementId (必需)

字符串. 你在 Unity Ads 信息中心 中配置的一个展示位 ID。

示例

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 Unity Ads plugin
unityads.init( adListener, { appId="YOUR_UNITYADS_GAME_ID" } )

-- Sometime later, check if an ad (placement ID) is ready for display
print( unityads.isLoaded( "YOUR_UNITYADS_PLACEMENT_ID" ) )