SplitScript reference / Language / class
class
declaration
class Name from ["Alias", ...] { Type field; static Type field; if layout.dimension == Variant { ... } }
Declares a typed managed class binding.
The class name T denotes an immutable local snapshot, while T.Ref denotes a live remote object reference. Fields without static are read fallibly from a T.Ref; static fields are read through the class name. Each live field hop yields T!, so postfix ? can propagate an unsuccessful lookup to the surrounding state field, function, or retry boundary. Calling reference.snapshot() reads every active instance field first and exposes one T! only when the complete snapshot succeeds; no partially populated object escapes when a read fails. Conditional fields follow the refined attachment layout. Live scalar paths reread remote memory without allocating a GC object, while snapshots and arrays materialize owned values. await T.instances() cooperatively scans readable, writable, non-executable process memory and returns a completed [T.Ref] snapshot. A UnityGameObject obtained through unity.scenes can use component<T>() to find the same typed T.Ref by runtime class. Both traversal paths are bounded, and generated binders, readers, snapshots, and scans are retained only when used. The optional from list supplies runtime metadata names. Fields declared directly in the class are always available. Put build-specific fields in an if / else if / else chain over the attachment-wide layout value. Each later branch describes exactly the layouts left unmatched by earlier branches, and the same branch predicate refines those fields in ordinary code. Mono and IL2CPP metadata traversal remains private to the Unity provider.
Examples
Follow a typed managed field path
score: u32 = GameManager.instance?.player?.score?
Capture one transactional class snapshot
manager: GameManager = GameManager.instance?.snapshot()?
Discover live instances cooperatively
let managers = await GameManager.instances()
Read a component from a scene hierarchy
let scene = unity.scenes.active() else return
let object = scene.find("Managers/GameManager") else return
let manager = object.component<GameManager>() else return