Properties
Scriptable Variable
Last updated
Scriptable Variable
Last updated
Let’s go through its properties, starting from the Header:
Description: Add/edit an optional description to your SV
Tag: Makes it easier to filter in the Soap Wizard.
Value: the current value of the variable. Can be changed in inspector, at runtime, by code or in unity events. Changing the value will trigger an event “OnValueChanged” that can be registered to by code. See examples for practical usage.
PreviousValue: the previous value of the variable. Accessible only via code. (not visible in the inspector)
Debug Log Enabled: if true, will log in the console whenever this value is changed.
Saved: If true, the value of the variable will be saved to Player Prefs when it changes. (See 1_ScriptableVariables_Example scene & documentation).
Default Value: Default value used the first time you load from PlayerPrefs.
Save Guid: by default, a unique Guid is created for the variable. In case you want to override it, change this setting to Manual and assign your own custom Guid.
Reset On: when is this variable reset (or loaded, if saved)?
Scene Loaded: whenever a scene is loaded. Use this if you want the variable to be reset if it is only used in a single scene. Note: does not reset when loading additive scenes.
Application Start: reset once when the game starts. Useful if you want changes made to the variable to persist across scenes.
None: will not reset(useful for Runtime Variables)
Is Clamped: only for FloatVariable and IntVariable, gives you the ability to clamp its value. (See 1_ScriptableVariables Documentation).
In the Editor, non-saved Scriptable Variables automatically revert to their initial values (the values shown in the inspector before entering play mode) upon exiting play mode.
Additionally, there is a convenient utility button labeled 'Reset to Initial Value.' This allows you to quickly reset the variable to its initial value from the inspector.