We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7555ed6 commit 3d80231Copy full SHA for 3d80231
Runtime/Variables/ScriptableVariable.cs
@@ -13,6 +13,11 @@ public abstract class ScriptableVariable<T> : ScriptableObject
13
/// </summary>
14
public abstract T value { get; set; }
15
16
+ /// <summary>
17
+ /// The default value of the variable.
18
+ /// </summary>
19
+ public virtual T defaultValue => default(T);
20
+
21
#if UNITY_EDITOR
22
#pragma warning disable 0414
23
[Multiline]
@@ -21,6 +26,15 @@ public abstract class ScriptableVariable<T> : ScriptableObject
26
private string m_DeveloperDescription = "";
27
#pragma warning restore 0414
28
#endif
29
30
31
+ /// Resets the value to its default value.
32
33
+ public void ResetToDefault()
34
+ {
35
+ value = defaultValue;
36
+ }
37
24
38
}
25
39
40
0 commit comments