Class Saving<T>
Data that auto save into player saving data
Type Parameters
Name | Description |
---|---|
T | Type of the data |
Constructors
Saving(string, T, SavingLocation)
Declaration
public Saving(string key, T defaultValue, SavingLocation location)
Parameters
Type | Name | Description |
---|---|---|
string | key | Unique key to identify this data |
SavingLocation | location | Set to "global" if this data shares between all saving slots |
Properties
DefaultValue
Default value
Declaration
public T DefaultValue { get; init; }
Value
Current value it holds
Declaration
public T Value { get; set; }
Methods
GetValue(bool)
Get the value it currently holds
Declaration
public T GetValue(bool forceLoad = false)
SetValue(T, bool)
Set the value it currently holds
Declaration
public void SetValue(T value, bool forceSave = false)
StringToValue(string)
Convert given string into the value
Declaration
protected abstract T StringToValue(string str)
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
ValueToString(T)
Convert given value into string data
Declaration
protected abstract string ValueToString(T value)