Skip to content

Debology.Debby.Modules.Adjust

AdjustableValue<T> Class

A flexible adjustable value that can work with stored values or getter/setter functions. You should use this if you want to add controls to Adjust at runtime.

csharp
public class AdjustableValue<T> : Debology.Debby.Modules.Adjust.IAdjustableValue<T>, Debology.Debby.Modules.Adjust.IAdjustableValueBase, Debology.Debby.Modules.Adjust.IAdjustable, Debology.Debby.Modules.Adjust.ITrackableValue

Type parameters

T

The type of the value

Inheritance System.Object 🡒 UnityEngine.UIElements.INotifyValueChanged 🡒 AdjustableValue<T>

Implements Debology.Debby.Modules.Adjust.IAdjustableValue<T>, Debology.Debby.Modules.Adjust.IAdjustableValueBase, Debology.Debby.Modules.Adjust.IAdjustable, Debology.Debby.Modules.Adjust.ITrackableValue

Constructors

AdjustableValue(Func<T>, Action<T>) Constructor

Creates a new adjustable value.

csharp
public AdjustableValue(System.Func<T> getter, System.Action<T> setter=null);

Parameters

getter System.Func<T>

Getter function to retrieve the current value

setter System.Action<T>

Optional setter function to update the value

Exceptions

System.ArgumentException
Thrown when setter is provided without getter

AdjustableValue(T) Constructor

Creates a new adjustable value.

csharp
public AdjustableValue(T initialValue);

Parameters

initialValue T

Initial value

Exceptions

System.ArgumentException
Thrown when setter is provided without getter

Properties

AdjustableValue<T>.ReadOnly Property

Gets whether this value is read-only (only getter provided).

csharp
public bool ReadOnly { get; }

Implements ReadOnly

Property Value

System.Boolean

AdjustableValue<T>.value Property

Gets or sets the current value, notifying subscribers of changes, if the value has changed.

csharp
public T value { get; set; }

Property Value

T

AdjustableValue<T>.ValueType Property

Gets the runtime type of the value.

csharp
public System.Type ValueType { get; }

Implements ValueType

Property Value

System.Type

Methods

AdjustableValue<T>.SetValueWithoutNotify(T) Method

Sets the value without triggering change notifications.

csharp
public void SetValueWithoutNotify(T newValue);

Parameters

newValue T

The new value to set

Events

AdjustableValue<T>.OnValueChanged Event

Event raised when the value changes.

csharp
public event Action<T> OnValueChanged;

Implements OnValueChanged

Event Type

System.Action<T>