Skip to main content

Class ScriptableObjectSettingsProvider

A helper class for displaying ScriptableObject-based settings in the Unity Editor using the SettingsProvider interface.

public class ScriptableObjectSettingsProvider : SettingsProvider

Inheritance​

Constructors​

ScriptableObjectSettingsProvider(ScriptableObject, SettingsScope, string)​

Initializes a new instance of the ScriptableObjectSettingsProvider class.

public ScriptableObjectSettingsProvider(ScriptableObject settings, SettingsScope scope, string displayPath)

Parameters​

NameTypeDescription
settingsScriptableObjectThe ScriptableObject settings instance to display.
scopeSettingsScopeThe scope of the settings (User or Project).
displayPathstringThe display path for the settings in the Unity Settings window.

Fields​

settings​

The settings instance being edited.

public readonly ScriptableObject settings

Field Value​

ScriptableObject

Properties​

serializedSettings​

The serialized object for the settings instance.

public SerializedObject serializedSettings { get; }

Property Value​

SerializedObject

Methods​

HasSearchInterest(string)​

Builds the set of search keywords based on the serialized object.

public override bool HasSearchInterest(string searchContext)

Parameters​

NameTypeDescription
searchContextstringThe search context string.

Returns​

bool — True if there are search keywords, otherwise false.

OnActivate(string, VisualElement)​

Called when the settings are displayed in the UI.

public override void OnActivate(string searchContext, VisualElement rootElement)

Parameters​

NameTypeDescription
searchContextstringThe search context string for filtering the settings.
rootElementVisualElementThe root UI element to attach the settings UI to.

OnDeactivate()​

Called when the settings are no longer displayed in the UI.

public override void OnDeactivate()

OnGUI(string)​

Displays the settings in the Unity Editor.

public override void OnGUI(string searchContext)

Parameters​

NameTypeDescription
searchContextstringThe search context string for filtering the settings.
  • Constructors
    • ScriptableObjectSettingsProvider(ScriptableObject, SettingsScope, string)
  • Fields
    • settings
  • Properties
    • serializedSettings
  • Methods
    • HasSearchInterest(string)
    • OnActivate(string, VisualElement)
    • OnDeactivate()
    • OnGUI(string)