Graphics
Add visual meshes to objects with the graphics component
The graphics component provides your object with a graphical mesh.
Properties
Shape
You can set various types of meshes depending on what you are aiming to do.
- Box: A uniform cube with the origin in the center of the object.
- Sphere: A sphere with uniform radius and centered at the center of the object.
- Capsule: A capsule shaped mesh with uniform radius and centered at the center of the object.
- Cylinder: A cylinder with uniform radius and centered at the center of the object.
- Mesh: A customized imported mesh.
When importing 3D assets in the gltf or glb format the objects with an associated mesh will create automatically a graphics components. The mesh type cannot be changed. To change the mesh type you should eliminate the graphics component and add a new one with a customized mesh type.
Size
The size property is available only for primitive shapes. Use it to set the dimensions of simple shapes (box, sphere, capsule, cylinder). The available fields depend on the selected primitive:
- Box:
x,y,z(depth, width, height). - Sphere:
radius. - Capsule:
radius,height. Theheightshould be greater than 2 × radius to avoid a deformed capsule. - Cylinder:
radius,height - Mesh: Mesh colliders don’t expose size parameters. To change their dimensions, use the Transform component’s scale.
Note
When resizing primitives, ensure the Transform scale of the object and all its parents is set to (1, 1, 1).