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 a user-specific flag that indicates whether a user should receive personalized or contextual advertisement before initialization (before [unityads.init()][plugin.unityad-v4.init])
unityads.setPersonalizedAds( showPersonalizedAds )
Boolean. false indicates that the user may not receive personalized ads and true indicates that the user may receive personalized ads
local unityads = require( "plugin.unityads.v4" )
local function adListener( event )
if ( event.phase == "init" ) then -- Successful initialization
end
end
-- Flag for personalized ads before initialize
unityads.setPersonalizedAds( true )
-- Initialize the Unity Ads plugin
unityads.init( adListener, { appId="YOUR_UNITYADS_GAME_ID" } )