Struct RenderMesh
Defines the mesh and rendering properties of an entity.
Namespace: Unity.Rendering
Syntax
[Serializable]
public struct RenderMesh : ISharedComponentData, IEquatable<RenderMesh>
Remarks
Add a RenderMesh component to an entity to define its graphical attributes. The entity must also have a LocalToWorld component from the Unity.Transforms namespace.
The standard ECS conversion systems add RenderMesh components to entities created from GameObjects that contain UnityEngine.MeshRenderer and UnityEngine.MeshFilter components.
RenderMesh is a shared component, which means all entities of the same Archetype and same RenderMesh settings are stored together in the same chunks of memory. The rendering system batches the entities together to reduce the number of draw calls.
Fields
castShadows
How shadows are cast.
Declaration
public ShadowCastingMode castShadows
Field Value
Type | Description |
---|---|
ShadowCastingMode |
Remarks
See ShadowCastingMode. For entities converted from GameObjects, this value is copied from the Cast Shadows property of the source Mesh Renderer Component.
layer
The LayerMask index.
Declaration
public int layer
Field Value
Type | Description |
---|---|
Int32 |
Remarks
For entities converted from GameObjects, this value is copied from the Layer setting of the source GameObject.
material
A reference to a UnityEngine.Material object.
Declaration
public Material material
Field Value
Type | Description |
---|---|
Material |
Remarks
For efficient rendering, the material should enable GPU instancing. For entities converted from GameObjects, this value is derived from the Materials array of the source Mesh Renderer Component.
mesh
A reference to a UnityEngine.Mesh object.
Declaration
public Mesh mesh
Field Value
Type | Description |
---|---|
Mesh |
needMotionVectorPass
Declaration
public bool needMotionVectorPass
Field Value
Type | Description |
---|---|
Boolean |
receiveShadows
Whether shadows should be cast onto the object.
Declaration
public bool receiveShadows
Field Value
Type | Description |
---|---|
Boolean |
Remarks
Progressive Lightmappers only. For entities converted from GameObjects, this value is copied from the Receive Shadows property of the source Mesh Renderer Component.
subMesh
The submesh index.
Declaration
public int subMesh
Field Value
Type | Description |
---|---|
Int32 |
Methods
Equals(RenderMesh)
Two RenderMesh objects are equal if their respective property values are equal.
Declaration
public bool Equals(RenderMesh other)
Parameters
Type | Name | Description |
---|---|---|
RenderMesh | other | Another RenderMesh. |
Returns
Type | Description |
---|---|
Boolean | True, if the properties of both RenderMeshes are equal. |
GetHashCode()
A representative hash code.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A number that is guaranteed to be the same when generated from two objects that are the same. |