类型 函数 返回值 无 修订版 2024.3703 版 关键词 广告、Unity Ads、展示 另请参见 unityads.isLoaded() unityads.*
展示一个 Unity Ads 视频插页广告或激励视频广告。
与先前的插件不同,你现在需要使用 unityads.load() 加载展示位 ID,并且会收到一个 event.phase 已加载
。
unityads.show( placementId )
local unityads = require( "plugin.unityads.v4" ) -- Unity Ads listener function local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.provider ) --Load ad before we show unityads.load("YOUR_UNITYADS_PLACEMENT_ID") 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