ValueReference<T> Class
Definition
Section titled “Definition”Allows you to reference a Hertzole.ScriptableValues.ScriptableValue1 or a constant value.
[Serializable]public class ValueReference<T>Type Parameters
Section titled “Type Parameters”T
The type that the value should be.
Inheritance object
Constructors
Section titled “Constructors”ValueReference()
Section titled “ValueReference()”Creates a new Hertzole.ScriptableValues.ValueReference1 of type Reference.
public ValueReference()ValueReference(T)
Section titled “ValueReference(T)”Creates a new Hertzole.ScriptableValues.ValueReference1 of type Constant with the given constant value.
public ValueReference(T constantValue)Parameters
Section titled “Parameters”constantValue T
The constant value.
ValueReference(ScriptableValue<T>)
Section titled “ValueReference(ScriptableValue<T>)”Creates a new Hertzole.ScriptableValues.ValueReference1 of type Reference with the given reference value.
public ValueReference(ScriptableValue<T> referenceValue)Parameters
Section titled “Parameters”referenceValue ScriptableValue<T>
The reference value.
ValueReference(AssetReferenceT<ScriptableValue<T>>)
Section titled “ValueReference(AssetReferenceT<ScriptableValue<T>>)”Creates a new Hertzole.ScriptableValues.ValueReference1 of type Addressable with the given addressable reference.
public ValueReference(AssetReferenceT<ScriptableValue<T>> addressableReference)Parameters
Section titled “Parameters”addressableReference AssetReferenceT<ScriptableValue<T>>
The addressable reference.
Properties
Section titled “Properties”Get or set the current value. This can be changed at runtime.
public T Value { get; set; }Remarks
Section titled “Remarks”If Hertzole.ScriptableValues.ValueReference1.ValueType is set to Constant, this will set the constant value. If Hertzole.ScriptableValues.ValueReference1.ValueType is set to Reference, this will set the value of the referenced Hertzole.ScriptableValues.ScriptableValue1. If Hertzole.ScriptableValues.ValueReference1.ValueType is set to Addressable, this will set the value of the referenced Hertzole.ScriptableValues.ScriptableValue1 if it is loaded.
ValueType
Section titled “ValueType”Get the type of value reference.
public ValueReferenceType ValueType { get; }IsAddressable
Section titled “IsAddressable”Checks if the value is an addressable value.
public bool IsAddressable { get; }Remarks
Section titled “Remarks”This will always return false if the addressables package isn’t installed.
IsAddressableLoaded
Section titled “IsAddressableLoaded”Checks if the addressable asset is loaded.
public bool IsAddressableLoaded { get; }Remarks
Section titled “Remarks”This will always return true if the addressables package isn’t installed.
AssetHandle
Section titled “AssetHandle”The handle to the loaded addressable asset.
public AsyncOperationHandle<ScriptableValue<T>> AssetHandle { get; }Remarks
Section titled “Remarks”This will be a default UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle1 if Hertzole.ScriptableValues.ValueReference1.LoadAddressableAssetAsync(System.Action%7bUnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle%7bHertzole.ScriptableValues.ScriptableValue%7b0%7d%7d%7d) hasn’t been called yet.
Methods
Section titled “Methods”SetValueWithoutNotify(T)
Section titled “SetValueWithoutNotify(T)”Sets the current value without invoking the Hertzole.ScriptableValues.ScriptableValue1.OnValueChanging and Hertzole.ScriptableValues.ScriptableValue1.OnValueChanged events.
public void SetValueWithoutNotify(T value)Parameters
Section titled “Parameters”value T
LoadAddressableAssetAsync(Action<AsyncOperationHandle<ScriptableValue<T>>>?)
Section titled “LoadAddressableAssetAsync(Action<AsyncOperationHandle<ScriptableValue<T>>>?)”Loads the addressable asset asynchronously.
public AsyncOperationHandle<ScriptableValue<T>> LoadAddressableAssetAsync(Action<AsyncOperationHandle<ScriptableValue<T>>>? onLoaded = null)Parameters
Section titled “Parameters”onLoaded Action<AsyncOperationHandle<ScriptableValue<T>>>
Optional callback that is called when the asset is loaded.
Returns
Section titled “Returns”AsyncOperationHandle<ScriptableValue<T>>
The handle to the loaded addressable asset.
Exceptions
Section titled “Exceptions”NotSupportedException
Hertzole.ScriptableValues.ValueReference1.ValueType is not Addressable.
ReleaseAddressableAsset()
Section titled “ReleaseAddressableAsset()”Releases the addressable asset.
public void ReleaseAddressableAsset()Events
Section titled “Events”OnValueChanging
Section titled “OnValueChanging”Called before the current value is set.
public event ValueEventHandler<T> OnValueChangingEvent Type
Section titled “Event Type”OnValueChanged
Section titled “OnValueChanged”Called after the current value is set.
public event ValueEventHandler<T> OnValueChanged