Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetDialogOptOutDecision(DialogOptOutDecisionType, string)

This method displays a modal dialog that lets the user opt-out of being shown the current dialog box again.
Read time 1 minuteLast updated 14 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public static bool GetDialogOptOutDecision(DialogOptOutDecisionType dialogOptOutDecisionType, string dialogOptOutDecisionStorageKey)

Parameters

dialogOptOutDecisionType

The type of opt-out decision a user can make.

dialogOptOutDecisionStorageKey

The unique key setting to store the decision under.

Returns

Type

Description

booltrue if the user previously opted out of seeing the dialog associated with dialogOptOutDecisionStorageKey. Returns false if the user did not yet opt out.

Remarks

Use this method as a short-hand to query the opt-out decision a user made on a dialog displayed via EditorUtility.DisplayDialog.
You don't need to query this before you call EditorUtility.DisplayDialog, as Unity handles it automatically.
If the user chooses to opt-out of a dialog box, Unity stores this decision. If dialogOptOutDecisionType is set to DialogOptOutDecisionType.ForThisMachine Unity stores it via EditorPrefs.SetBool. If dialogOptOutDecisionType is set to DialogOptOutDecisionType.ForThisSession Unity stores it via SessionState.SetBool. In both cases Unity stores it under the key provided as dialogOptOutDecisionStorageKey.
This method automatically selects the storage place based on the provided dialogOptOutDecisionType.
If you want to the let the user change their decision that is stored in EditorPrefs, you can add this to the Editor Preferences with a SettingsProvider.
Additional Resources: EditorUtility.DisplayDialog function.