SplitScript reference / UnityScene / find

UnityScene.find

Method

UnityScene.find(path: String) -> UnityGameObject!

Finds a GameObject by an exact hierarchy path.

The first path segment selects a root object in this scene. Every later segment selects one direct child. Empty segments and missing objects return an error. Traversal is bounded so malformed native lists cannot monopolize an update.

Parameters

  • path: Exact slash-separated hierarchy path to resolve.

Effects: allocates, reads process memory, requires an attached process

Runtime behavior: available while a process is attached, except in onDetach; synchronous

Examples

Find the player beneath a world root

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