Struct RenderMeshArray
A shared component that contains meshes and materials.
Namespace: Unity.Rendering
Syntax
public struct RenderMeshArray : ISharedComponentData, IQueryTypeParameter, IEquatable<RenderMeshArray>
Constructors
RenderMeshArray(Material[], Mesh[])
Constructs an instance of RenderMeshArray from an array of materials and an array of meshes.
Declaration
public RenderMeshArray(Material[] materials, Mesh[] meshes)
Parameters
Type | Name | Description |
---|---|---|
Material[] | materials | The array of materials to use in the RenderMeshArray. |
Mesh[] | meshes | The array of meshes to use in the RenderMeshArray. |
Properties
Materials
Accessor property for the materials array.
Declaration
public Material[] Materials { get; set; }
Property Value
Type | Description |
---|---|
Material[] |
Meshes
Accessor property for the meshes array.
Declaration
public Mesh[] Meshes { get; set; }
Property Value
Type | Description |
---|---|
Mesh[] |
Methods
CombineRenderMeshArrays(List<RenderMeshArray>)
Combines a list of RenderMeshArrays into one RenderMeshArray.
Declaration
public static RenderMeshArray CombineRenderMeshArrays(List<RenderMeshArray> renderMeshArrays)
Parameters
Type | Name | Description |
---|---|---|
List<RenderMeshArray> | renderMeshArrays | The list of RenderMeshArray instances to combine. |
Returns
Type | Description |
---|---|
RenderMeshArray | Returns a RenderMeshArray instance that contains all of the meshes and materials. |
CombineRenderMeshes(List<RenderMesh>)
Combines a list of RenderMeshes into one RenderMeshArray.
Declaration
public static RenderMeshArray CombineRenderMeshes(List<RenderMesh> renderMeshes)
Parameters
Type | Name | Description |
---|---|---|
List<RenderMesh> | renderMeshes | The list of RenderMesh instances to combine. |
Returns
Type | Description |
---|---|
RenderMeshArray | Returns a RenderMeshArray instance that contains containing all of the meshes and materials. |
ComputeHash128()
Calculates and returns the 128-bit hash value of the component contents.
Declaration
public uint4 ComputeHash128()
Returns
Type | Description |
---|---|
uint4 | Returns the calculated 128-bit hash value. |
Remarks
This is equivalent to calling ResetHash128() and then GetHash128().
CreateWithDeduplication(List<Material>, List<Mesh>)
Creates the new instance of the RenderMeshArray from given mesh and material lists, removing duplicate entries.
Declaration
public static RenderMeshArray CreateWithDeduplication(List<Material> materialsWithDuplicates, List<Mesh> meshesWithDuplicates)
Parameters
Type | Name | Description |
---|---|---|
List<Material> | materialsWithDuplicates | The list of the materials. |
List<Mesh> | meshesWithDuplicates | The list of the meshes. |
Returns
Type | Description |
---|---|
RenderMeshArray | Returns a RenderMeshArray instance that contains all off the meshes and materials, and with no duplicates. |
Equals(Object)
Determines whether two object instances are equal based on their hashes.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the specified object is equal to the current object. Otherwise, returns false. |
Overrides
Equals(RenderMeshArray)
Determines whether two object instances are equal based on their hashes.
Declaration
public bool Equals(RenderMeshArray other)
Parameters
Type | Name | Description |
---|---|---|
RenderMeshArray | other | The object to compare with the current object. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the specified object is equal to the current object. Otherwise, returns false. |
GetHash128()
Returns a 128-bit hash that (almost) uniquely identifies the contents of the component.
Declaration
public uint4 GetHash128()
Returns
Type | Description |
---|---|
uint4 | Returns the 128-bit hash value. |
Remarks
This is useful to help make comparisons between RenderMeshArray instances less resource intensive.
GetHashCode()
Calculates the hash code for this object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The hash code. |
Overrides
GetMaterial(MaterialMeshInfo)
Gets the material for given MaterialMeshInfo.
Declaration
public Material GetMaterial(MaterialMeshInfo materialMeshInfo)
Parameters
Type | Name | Description |
---|---|---|
MaterialMeshInfo | materialMeshInfo | The MaterialMeshInfo to use. |
Returns
Type | Description |
---|---|
Material | Returns the associated material instance, or null if the material is runtime. |
GetMesh(MaterialMeshInfo)
Gets the mesh for given MaterialMeshInfo.
Declaration
public Mesh GetMesh(MaterialMeshInfo materialMeshInfo)
Parameters
Type | Name | Description |
---|---|---|
MaterialMeshInfo | materialMeshInfo | The MaterialMeshInfo to use. |
Returns
Type | Description |
---|---|
Mesh | Returns the associated Mesh instance or null if the mesh is runtime. |
ResetHash128()
Recalculates the 128-bit hash value of the component.
Declaration
public void ResetHash128()
Operators
Equality(RenderMeshArray, RenderMeshArray)
The equality operator == returns true if its operands are equal, false otherwise.
Declaration
public static bool operator ==(RenderMeshArray left, RenderMeshArray right)
Parameters
Type | Name | Description |
---|---|---|
RenderMeshArray | left | The left instance to compare. |
RenderMeshArray | right | The right instance to compare. |
Returns
Type | Description |
---|---|
Boolean | True if left and right instances are equal and false otherwise. |
Inequality(RenderMeshArray, RenderMeshArray)
The not equality operator != returns false if its operands are equal, true otherwise.
Declaration
public static bool operator !=(RenderMeshArray left, RenderMeshArray right)
Parameters
Type | Name | Description |
---|---|---|
RenderMeshArray | left | The left instance to compare. |
RenderMeshArray | right | The right instance to compare. |
Returns
Type | Description |
---|---|
Boolean | False if left and right instances are equal and true otherwise. |