Skip to main content

API

PlayCanvas React provides a declarative, component-based API for building 3D applications. The API is organized into core components, engine components and hooks.

Core

  • <Application/> - Root component that initializes the PlayCanvas engine and provides a rendering context
  • <Entity/> - Fundamental scene graph building block with position, rotation and scale
  • <Gltf/> - Load and instantiate GLB/GLTF scenes
  • <Modify.*> - Declaratively modify entities and components inside an imported GLB

Components

Components add behavior to entities. Nest them inside an <Entity/> to attach the corresponding PlayCanvas component.

Hooks

React hooks for integrating with the PlayCanvas engine lifecycle. See the Hooks overview for usage patterns and best practices.

  • useApp - Access the PlayCanvas Application instance
  • useParent - Get the parent Entity from context
  • useAsset - Load any type of PlayCanvas asset
  • useAppEvent - Subscribe to application events
  • useMaterial - Create and manage materials
  • usePhysics - Access physics context and state