SilviaCore

The Core is the root class for most of the SILVIA API classes and methods outlined below, and also has some of its own methods under the dot (“.”) syntax. In order to get to the other API sections, you must first reference the Core.

Example Usage (C#)


//Example use of Core reference to get into ApiApp()
_core.ApiApp().ConsoleOut("Core is called _core in internal SILVIA scripts.");

Discussion
In SILVIA’s internal scripts, the Core reference is always spelled “_core”. In external scripts, you can define a public SilviaCore and store or pass a reference to it. SilviaCore references are not visible in the Unity Inspector, but they do exist and their presence can be confirmed in C# scripts. Core commands coming from outside can use whatever public reference name you choose.

Our team has found it useful to keep any external reference to the SilviaCore as “Core” with a capital C, although generally in Unity you want to start any public variables with lowercase letters to avoid confusion with other Types. This helps keep a distinction between code written for SILVIA to be used internally versus externally.

Function
Description
Core.SetCreated
Sets the “created” bool for the referenced SILVIA Core.
Core.SetVariable
Sets a declared Variable name in the SILVIA Core.
Core.GetVariable
Returns the string value of a given Variable in the SILVIA Core. Can be parsed to other types thereafter.
Core.GetInt
Parses and returns an int value from a given Variable in the SILVIA Core, if any.
Core.GetFloat
Parses and returns a float value from a given Variable in the SILVIA Core, if any.
Core.AddTimedFunctionCS
Adds a Timed Function to the Core using a Method in SILVIA Brain File Scripts.
Core.AddVariableTimedFunction
Adds a Variable Timed Function to the Core using a Method in SILVIA Brain File Scripts.
Core.RemoveTimedFunctionCS
Removes a Timed Function from the Core by name, canceling it. Core.SetActiveTimedFunctionEndTime Sets a new End Time for the named Timed Function.
Core.SetActiveTimedFunctionPeriod
Sets a new Period length for the named Timed Function. The Function must be set to Periodic
Core.SetActiveTimedFunctionMinPeriod
Sets a new Minimum Period length for the named Time Function. Minimum Periods only apply to Variable Timed Functions.
Core.SetActiveTimedFunctionVariability
Sets whether the named Timed Function is Periodic or recurring.
Sets whether the named Timed Function is Variable. Variable Timed