Data Types
Gnosis Engine uses a set of custom, engine-neutral data types to ensure that logic remains decoupled from Unity and to optimize performance through zero-boxing serialization.
Core Primitives
The following standard C# types are natively supported by the Gnosis Store and Event Bus:
- Int: Standard 32-bit integer.
- Float: Standard 32-bit floating-point number.
- Bool: Boolean value (
true/false). - Long: 64-bit integer.
- String: UTF-16 string.
Engine-Neutral Math Types
Gnosis provides its own math types to avoid a direct dependency on UnityEngine in the core logic assembly. These are automatically converted to Unity types (like Vector3) by the Unity Adapters.
GnosisVector2
A lightweight 2D vector used for positions, scales, or directions in 2D space.
- Fields:
X,Y(floats).
GnosisVector3
A lightweight 3D vector.
- Fields:
X,Y,Z(floats).
GnosisColor
An RGBA color representation.
- Fields:
R,G,B,A(floats, typically 0.0 to 1.0).
Structured Data
GnosisNode
The GnosisNode is the primary way developers interact with structured data (objects and lists) in the engine. It acts as a “smart facade” or handle to data stored in the GnosisStore.
- Object: A key-value dictionary (e.g.,
{ "hp": 100, "name": "Hero" }). - List: An ordered collection of values.
Implementation Details: GnosisValue
Under the hood, all these types are stored in a GnosisValue struct. This is an inline union (using LayoutKind.Explicit) that overlaps memory for different types. This ensures that the engine can pass data around with zero boxing, which is critical for high-performance Unity games.