ScriptableDictionary Class
Definition
Section titled “Definition”Base class for all ScriptableDictionary<TKey, TValue>.
[HelpURL("https://hertzole.github.io/scriptable-values/types/scriptable-dictionary")]public abstract class ScriptableDictionary : RuntimeScriptableObject, INotifyPropertyChanging, INotifyPropertyChanged, IStackTraceProvider, ICanBeReadOnly, INotifyCollectionChangedInheritance object → UnityEngine.Object → UnityEngine.ScriptableObject → RuntimeScriptableObject
Implements INotifyPropertyChanging, INotifyPropertyChanged, IStackTraceProvider, ICanBeReadOnly, INotifyCollectionChanged
Remarks
Section titled “Remarks”You should probably inherit from ScriptableDictionary<TKey, TValue> instead.
Fields
Section titled “Fields”isReadOnlyChangedEventArgs
Section titled “isReadOnlyChangedEventArgs”public static readonly PropertyChangedEventArgs isReadOnlyChangedEventArgsisReadOnlyChangingEventArgs
Section titled “isReadOnlyChangingEventArgs”public static readonly PropertyChangingEventArgs isReadOnlyChangingEventArgssetEqualityCheckChangedEventArgs
Section titled “setEqualityCheckChangedEventArgs”public static readonly PropertyChangedEventArgs setEqualityCheckChangedEventArgssetEqualityCheckChangingEventArgs
Section titled “setEqualityCheckChangingEventArgs”public static readonly PropertyChangingEventArgs setEqualityCheckChangingEventArgsclearOnStartChangedEventArgs
Section titled “clearOnStartChangedEventArgs”public static readonly PropertyChangedEventArgs clearOnStartChangedEventArgsclearOnStartChangingEventArgs
Section titled “clearOnStartChangingEventArgs”public static readonly PropertyChangingEventArgs clearOnStartChangingEventArgscountChangedEventArgs
Section titled “countChangedEventArgs”public static readonly PropertyChangedEventArgs countChangedEventArgscountChangingEventArgs
Section titled “countChangingEventArgs”public static readonly PropertyChangingEventArgs countChangingEventArgsProperties
Section titled “Properties”SetEqualityCheck
Section titled “SetEqualityCheck”If true, an equality check will be run before setting an item through the indexer to make sure the new object is not the same as the old one.
[CreateProperty]public abstract bool SetEqualityCheck { get; set; }ClearOnStart
Section titled “ClearOnStart”If true, the ScriptableDictionary<TKey, TValue> will be cleared on play mode start/game boot.
[CreateProperty]public abstract bool ClearOnStart { get; set; }Gets the number of key/value pairs contained in the ScriptableDictionary<TKey, TValue>.
[CreateProperty]public abstract int Count { get; protected set; }IsReadOnly
Section titled “IsReadOnly”If read only, the ScriptableDictionary<TKey, TValue> cannot be changed at runtime and won’t be cleared on start.
[CreateProperty]public abstract bool IsReadOnly { get; set; }Methods
Section titled “Methods”WarnIfLeftOverSubscribers()
Section titled “WarnIfLeftOverSubscribers()”Warns if there are any left-over subscribers to the events.
protected override void WarnIfLeftOverSubscribers()Remarks
Section titled “Remarks”This will only be called in the Unity editor and builds with the DEBUG flag.
Clear()
Section titled “Clear()”Removes all keys and values from the ScriptableDictionary<TKey, TValue>.
public abstract void Clear()Exceptions
Section titled “Exceptions”ReadOnlyException
If the object is read-only and the application is playing.
EnsureCapacity(int)
Section titled “EnsureCapacity(int)”Ensures that the dictionary can hold up to a specified number of entries without any further expansion of its backing storage.
public abstract int EnsureCapacity(int capacity)Parameters
Section titled “Parameters”capacity int
The number of entries.
Returns
Section titled “Returns”int
The current capacity of the ScriptableDictionary<TKey, TValue>.
Exceptions
Section titled “Exceptions”ArgumentOutOfRangeException
capacity is less than 0.
TrimExcess()
Section titled “TrimExcess()”Sets the capacity of this ScriptableDictionary<TKey, TValue> to what it would be if it had been originally initialized with all its entries.
public abstract void TrimExcess()TrimExcess(int)
Section titled “TrimExcess(int)”Sets the capacity of this ScriptableDictionary<TKey, TValue> to hold up a specified number of entries without any further expansion of its backing storage.
public abstract void TrimExcess(int capacity)Parameters
Section titled “Parameters”capacity int
The new capacity.
Exceptions
Section titled “Exceptions”ArgumentOutOfRangeException
capacity is less than the number of items in the ScriptableDictionary<TKey, TValue>.