• Searches the the scene for a component of the given type.
    If the contextOrScene is not provided, the current context is used.

    Type Parameters

    Parameters

    • type: Constructor<T>

      The type of the component to search for.

    • contextOrScene: undefined | Object3D<Object3DEventMap> | { scene: Scene } = undefined

      The context or scene to search in. If not provided, the current context is used.

    • includeInactive: boolean = true

      If true, also inactive components are returned. Default is true.

    Returns null | T

    The first component of the given type found in the scene or null if none was found.

    const myComponent = findObjectOfType(MyComponent);