SetClanVariable
SetVariable
Method Documentation
Description
The SetVariable
methods allow for setting the value of a private variable within a clan. These methods come in two variants: a non-generic version that simply sets the value, and a generic version that sets the value and returns it cast to a specified type.
Method Signatures
SetVariable (Non-Generic)
public void SetVariable(string variableNameOrId, object value)
This method sets the value of a specified variable without returning it. If the variable does not exist, no action is taken.
SetVariable (Generic)
public T SetVariable<T>(string variableNameOrId, object value) where T : NVar
This method sets the value of a specified variable and returns the updated variable cast to the specified type T
. If the variable does not exist, it returns null
.
Example Usage
Non-Generic Usage
IM.Player.Clan.SetVariable("booleanVariable", true);
Sets the value of the variable booleanVariable
to true
for the player's clan.
Generic Usage
var booleanVar = IM.Player.Clan.SetVariable<NBool>("booleanVariable", true);
Debug.Log(booleanVar.Value);
Sets the value of the variable booleanVariable
to true
and retrieves it as an NBool
type. The booleanVar.Value
property returns the value as a bool
.
Note: booleanVar.Value
will return the value as a boolean type (bool
).