Function findObjectsOfType

  • Searches the the scene for all components 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.

    • Optionalarray: T[]
    • contextOrScene: undefined | Object3D<Object3DEventMap> | {
          scene: Scene;
      } = undefined

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

    Returns T[]

    const myComponents = findObjectsOfType(MyComponent);