Lens Scripting API
    Preparing search index...
    • [ByKey] Finds the first Component of a given type on the SceneObject itself or in its children.

      Type Parameters

      Parameters

      • sceneObject: SceneObject

        The SceneObject to start the search from.

      • componentType: K

        The string key of the component type to find (e.g., "Component.RenderMeshVisual").

      • OptionalmaxDepth: number

        The maximum number of levels to search down the hierarchy (for children).

      Returns ComponentNameMap[K]

      The first matching Component found, or null if none is found.

    • [ByScriptType] Finds the first Component of a given script type on the SceneObject itself or in its children.

      Type Parameters

      Parameters

      • sceneObject: SceneObject

        The SceneObject to start the search from.

      • componentType: TypeName<T>

        The script type name (e.g., Interactable.getTypeName())) to find.

      • OptionalmaxDepth: number

        The maximum number of levels to search down the hierarchy (for children).

      Returns T

      The first matching Component found, or null if none is found.