Components
A component encapsulates functionality that can be added to or removed from entities. For example, a component might enable an entity to play sound, render a 3D model or run a script.
You can add a component to an entity using the PlayCanvas Editor or by using the Engine API. The properties exposed by components are listed in the Inspector when you select an Entity.
Component Types
There are many different components defined in the PlayCanvas Engine:
Component | Description |
---|---|
Anim | Specifies the state graph and animations that can run on an entity hierarchy. |
Audio Listener | Specifies the location of the listener for 3D audio playback. |
Button | Creates a user interface button. |
Camera | Renders the scene from the location of the entity. |
Collision | Assigns a collision volume to the entity. |
Element | Defines a user interface text or image element. |
GSplat | Renders a 3D Gaussian Splat at the location of the entity. |
Layout Child | Overrides default Layout Group properties for one element. |
Layout Group | Automatically sets position and scale of child user interface elements. |
Light | Attaches a dynamic light source to the Entity. |
Particle System | Attaches a particle system to the Entity. |
Rigid Body | Adds the entity to the scene's physical simulation. |
Render | Renders a graphical primitive or a render asset. |
Screen | Defines the area and rendering of a user interface. |
Script | Allows the entity to run JavaScript fragments to implement custom behavior. |
Scrollbar | Defines a scrolling control for a Scrollview component. |
Scroll View | Defines a scrollable area in a user interface. |
Sound | Plays audio assets. |
Sprite | Renders 2D graphics at the location of the entity. |
Deprecated Components
PlayCanvas still provides some deprecated components. Use of these components is not recommended for new projects.
Component | Description |
---|---|
Animation | Specifies the animations that can run on the model specified by the entity's model component. |
Model | Renders a 3D model at the location of the entity. |