Skip to content

ScriptableValueListener<TValue> Class

Base class for a component that listens to ScriptableValue<T>.

C#
public abstract class ScriptableValueListener<TValue> : ScriptableListenerBase

TValue
The type to listen for.

Inheritance object → UnityEngine.Object → UnityEngine.Component → UnityEngine.Behaviour → UnityEngine.MonoBehaviour → ScriptableListenerBase

The value to listen to.

C#
public ScriptableValue<TValue>? TargetValue { get; set; }

When listeners should invoke their events.

C#
public InvokeEvents InvokeOn { get; set; }

What the old value needs to be for the event to be invoked.

C#
public TValue? FromValue { get; set; }

What the new value needs to be for the event to be invoked.

C#
public TValue? ToValue { get; set; }

How many parameters listeners should use when invoking their events.

C#
public InvokeParameters InvokeParameters { get; set; }

The event to invoke when the value is changing.

C#
public UnityEvent<TValue> OnValueChangingSingle { get; }

The event to invoke when the value has changed.

C#
public UnityEvent<TValue> OnValueChangedSingle { get; }

The event to invoke when the value is changing.

C#
public UnityEvent<TValue, TValue> OnValueChangingMultiple { get; }

The event to invoke when the value has changed.

C#
public UnityEvent<TValue, TValue> OnValueChangedMultiple { get; }

Sets the listening state of the object.

C#
protected override sealed void SetListening(bool listen)

listen bool
If the object should listen to the target value.

OnBeforeValueChangingInvoked(TValue, TValue)

Section titled “OnBeforeValueChangingInvoked(TValue, TValue)”

Called before the value changing event.

C#
protected virtual bool OnBeforeValueChangingInvoked(TValue oldValue, TValue newValue)

oldValue TValue
The current value.

newValue TValue
The new value being set.

bool
true if the event should be invoked; otherwise, false.

OnAfterValueChangingInvoked(TValue, TValue)

Section titled “OnAfterValueChangingInvoked(TValue, TValue)”

Called after the value changing event.

C#
protected virtual void OnAfterValueChangingInvoked(TValue oldValue, TValue newValue)

oldValue TValue
The previous value.

newValue TValue
The new value that was set.

OnBeforeValueChangedInvoked(TValue, TValue)

Section titled “OnBeforeValueChangedInvoked(TValue, TValue)”

Called before the value changed event.

C#
protected virtual bool OnBeforeValueChangedInvoked(TValue oldValue, TValue newValue)

oldValue TValue
The current value.

newValue TValue
The new value being set.

bool
true if the event should be invoked; otherwise, false.

OnAfterValueChangedInvoked(TValue, TValue)

Section titled “OnAfterValueChangedInvoked(TValue, TValue)”

Called after the value changed event.

C#
protected virtual void OnAfterValueChangedInvoked(TValue oldValue, TValue newValue)

oldValue TValue
The previous value.

newValue TValue
The new value that was set.