SplitScript reference / UnityGameObject

UnityGameObject

record

record UnityGameObject

A live GameObject in an attached Unity scene hierarchy.

This value retains the native Transform address used to reach the object. It is a live remote handle rather than an immutable snapshot: scene changes may invalidate it. component<T>() -> T.Ref! finds a component whose runtime class matches the declared managed schema class T. The resulting typed live reference supports ordinary managed field reads and .snapshot() when stable local state is required. Component traversal is bounded to keep a corrupt native component list from monopolizing an update.

Examples

Resolve a child object

whileAttached {
    let scene = unity.scenes.active() else return
    let camera = scene.find("World/Player/Camera") else return
    print(camera.name() else "Unknown")
}

Methods

MemberDescriptionAvailable through
childFinds one exact direct child by name.
findFinds a descendant by an exact path relative to this GameObject.
nameReads this GameObject's current name.