Spatial Lingo's sequencing of events is primarily handled by Unity's Visual Scripting package. This provides a node-based editor for developing high-level logic in a visual way. For Spatial Lingo, it's mostly used as a state machine, specifying the execution flow of logical units and managing contextual data.
Assets/SpatialLingo/Data/StateGraph/AppFlow.asset
This manages the entire flow of the app, where developers can view and edit the states of the app as needed. Open this asset by double-clicking it, or by selecting it and clicking "Edit Graph" in the inspector window.
Assets/SpatialLingo/Scripts/VisualScriptingUnits/* Assets/SpatialLingo/Scripts/States/*
These folders contain individual states that are indexed by the visual scripting package. They contain some abstraction layers to handle some common functionality when implementing a new node.
EventUnitWrapper.cs and ScriptingEvents.cs files in VisualScriptingUnits/ declare custom scripting events that can be used in the node editor. While the decision was made to transition away from visual scripting-related events, it serves as an example for abstracting event definitions to very small declarations.
- Adding the
IncludeInSettingsattribute to a plain C# class can allow its public members, static and instanced, to have nodes autogenerated for them by visual scripting. This includes constructors. For example, the following code block will add additional entries to the fuzzy finder after regenerating nodes:
using Unity.VisualScripting;
[IncludeInSettings(true)]
public class NewEmptyCSharpScript
{
public static string MyString { get; set; }
public string X;
public static int GetInt() => 5;
}
