Skip to main content

Class BaseScriptableVariable

Non-generic root of the scriptable variable hierarchy, providing a type-erased GetValue so that tools and UI components can display or compare any variable without knowing its concrete type at compile time.

public abstract class BaseScriptableVariable : ScriptableObject

Inheritance​

Derived​

BaseScriptableVariable<T>

Remarks​

A separate non-generic base is needed because Unity's Inspector, the VariableReferenceDrawer, and the database persistence layer all need to operate on collections of heterogeneous variables. The generic subclass BaseScriptableVariable handles the actual typed storage and SQLite I/O; this class only exposes the untyped surface.

Methods​

GetValue()​

Returns the current runtime value as an untyped object, allowing tools that don't know the concrete variable type to read it.

public abstract object GetValue()

Returns​

object — The current runtime value, or the initial value if no runtime value has been set.

IsValid()​

Returns true when GetValue would return a usable non-null value.

public virtual bool IsValid()

Returns​

bool — true if the runtime value is non-null; false otherwise.

Remarks​

The base implementation always returns false; the generic subclass overrides this to check whether the SQLite query returned a non-null result.