unityads.show()

类型 函数
返回值
修订版 版本 2024.3703
关键词 广告、推广、Unity 广告、展示
另请参见 unityads.isLoaded()
unityads.*

概览

展示一个 Unity 广告视频插页或奖励视频广告。

注意

使用 unityads.init() 初始化插件后,Unity 广告将自动开始为你在 Unity 广告 仪表板 中配置的展示位 ID 加载广告。

语法

unityads.show( placementId )
placementId (必需)

字符串. 你在 Unity 广告 仪表板 中配置的一个展示位 ID。

示例

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