Type Function Return value none Revision Release 2025.3721 Keywords ads, advertising, unityads, setHasUserConsent See also [unityads.init()][plugin.unityad-v4.init] [unityads.*][plugin.unityad-v4]
Set flag for compliance mode for the app before initialization (before [unityads.init()][plugin.unityad-v4.init])
unityads.setPrivacyMode( privacyMode )
String. supported modes are “app” (indicates that an app is directed at children), “mixed” (indicates that an app is directed at mixed audiences), or “none” (indicates that the entire app is not directed at children)
local unityads = require( "plugin.unityads.v4" )
local function adListener( event )
if ( event.phase == "init" ) then -- Successful initialization
end
end
-- Flag for privacy mode before initialize
unityads.setPrivacyMode( "app" )
-- Initialize the Unity Ads plugin
unityads.init( adListener, { appId="YOUR_UNITYADS_GAME_ID" } )