GetClanVariable
GetVariable Method Documentation
Description
The GetVariable methods allow for retrieving a private variable from a clan based on its name or ID. These methods come in two variants: a non-generic version that returns the variable as a base type, and a generic version that returns the variable cast to a specified type.
Method Signatures
GetVariable (Non-Generic)
public NVar GetVariable(string variableNameOrId)
This method retrieves the variable with the specified name or ID from the clan. It returns the variable as an NVar.
GetVariable (Generic)
public T GetVariable<T>(string variableNameOrId) where T : NVar
This method retrieves the variable with the specified name or ID from the clan and casts it to the specified type T. It returns the variable as T.
Example Usage
Non-Generic Usage
NVar variable = IM.Player.Clan.GetVariable("someVariable");
Debug.Log(variable.Value);
Retrieves the variable someVariable and logs its value.
Generic Usage
NBool booleanVar = IM.Player.Clan.GetVariable<NBool>("booleanVariable");
Debug.Log(booleanVar.Value);
Retrieves the variable booleanVariable and casts it to 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).