Components are basic building blocks that use data and logic to build your game. Use the mesh component like an asset. When selecting a mesh component, a dropdown menu of static meshes provides a way for you to use a default mesh or one that you made or imported.
The mesh component is an asset-generated component. An asset-generated component is a component class that is automatically created based on preexisting content in your project, such as a mesh, sound, or particle system asset. These assets may also expose properties that you can modify on the generated component.
You can add an asset-generated component to an entity by selecting +Component in the Details panel and navigating to the base class to find the component you want. You can also drag and drop the asset from the Content Browser into the Details panel for your entity. These asset-generated components also can be referenced specifically in your Verse code and appear in your Assets.digest.verse file.
You need to compile the Verse code for your project after you import or create your asset in order to generate the component class. You need at least one Verse written component to compile the Verse code.
To add a component to your entity, refer to Working with Entities and Components. The component is listed as mesh_component, which matches the Verse class for the mesh component. For more information about the Verse API for the mesh component, check out the mesh_component API reference.
Example
By using the mesh_component to gray box your level, you can easily switch out the default Static Meshes with ones you created or imported. Gray boxing a scene with the mesh_component does a few things:
Ensures the level design fits around the gameplay elements.
Lowers development time.
Turning an entity with the mesh_component into a prefab means quick iteration on a design.
Once a static mesh is applied to the mesh_component, the component is referenced by the default mesh object used to create the component at its base.
This is not the preferred method for using mesh_component. Refer to the Known Issues list on the Scene Graph page for more information.
You can only add one of a given component class or subclass. For example, you can only have one mesh_component on an entity. This extends to subclasses of components, meaning if you add a capsule_light_component to your entity, you cannot also add a rect_light_component since both are subclasses of light_component. The same limitation applies to custom components made in Verse.
Component Options
All basic component options on the mesh-component can be enabled, disabled, and overridden from the component card and can be used with a Verse component. Asset-generated components are always overridden from the component dropdown menu.
| Option | Value | Description |
|---|---|---|
Enable | True, False | Enables or disables the component in the scene. |
Collidable | True, False | The mesh may collide in the physics simulation when set to True. |
Queryable | True, False | The mesh can be queried in Verse code when set to True. |
Visible | True, False | The mesh visibility can be enabled and disabled in the scene. |
Material slots on the mesh_component are easily selected and overridden from the mesh dropdown menu where all available Static Meshes are listed.