docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct RenderMeshArray

    A shared component that contains meshes and materials.

    Implements
    ISharedComponentData
    IQueryTypeParameter
    Namespace: Unity.Rendering
    Assembly: Unity.Entities.Graphics.dll
    Syntax
    public struct RenderMeshArray : ISharedComponentData, IQueryTypeParameter

    Constructors

    RenderMeshArray(ReadOnlySpan<UnityObjectRef<Material>>, ReadOnlySpan<UnityObjectRef<Mesh>>, ReadOnlySpan<MaterialMeshIndex>)

    Constructs an instance of RenderMeshArray from an array of materials and an array of meshes.

    Declaration
    public RenderMeshArray(ReadOnlySpan<UnityObjectRef<Material>> materials, ReadOnlySpan<UnityObjectRef<Mesh>> meshes, ReadOnlySpan<MaterialMeshIndex> materialMeshIndices = default)
    Parameters
    Type Name Description
    ReadOnlySpan<UnityObjectRef<Material>> materials

    The array of materials to use in the RenderMeshArray.

    ReadOnlySpan<UnityObjectRef<Mesh>> meshes

    The array of meshes to use in the RenderMeshArray.

    ReadOnlySpan<MaterialMeshIndex> materialMeshIndices

    The array of MaterialMeshIndex to use in the RenderMeshArray.

    RenderMeshArray(Material[], Mesh[], MaterialMeshIndex[])

    Constructs an instance of RenderMeshArray from an array of materials and an array of meshes.

    Declaration
    public RenderMeshArray(Material[] materials, Mesh[] meshes, MaterialMeshIndex[] materialMeshIndices = null)
    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.

    MaterialMeshIndex[] materialMeshIndices

    The array of MaterialMeshIndex to use in the RenderMeshArray.

    Properties

    MaterialMeshIndices

    Accessor property for the MaterialMeshIndex array.

    Declaration
    public MaterialMeshIndex[] MaterialMeshIndices { get; set; }
    Property Value
    Type Description
    MaterialMeshIndex[]

    MaterialReferences

    Accessor property for the material references array.

    Declaration
    public UnityObjectRef<Material>[] MaterialReferences { get; set; }
    Property Value
    Type Description
    UnityObjectRef<Material>[]

    MeshReferences

    Accessor property for the mesh references array.

    Declaration
    public UnityObjectRef<Mesh>[] MeshReferences { get; set; }
    Property Value
    Type Description
    UnityObjectRef<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. The MaterialMeshIndices field is left to null.

    CombineRenderMeshes(List<RenderMeshUnmanaged>)

    Combines a list of RenderMeshes into one RenderMeshArray.

    Declaration
    public static RenderMeshArray CombineRenderMeshes(List<RenderMeshUnmanaged> renderMeshes)
    Parameters
    Type Name Description
    List<RenderMeshUnmanaged> renderMeshes

    The list of RenderMesh instances to combine.

    Returns
    Type Description
    RenderMeshArray

    Returns a RenderMeshArray instance that contains all of the meshes and materials. The MaterialMeshIndices field is left to null.

    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<UnityObjectRef<Material>>, List<UnityObjectRef<Mesh>>)

    Creates the new instance of the RenderMeshArray from given mesh and material lists, removing duplicate entries.

    Declaration
    public static RenderMeshArray CreateWithDeduplication(List<UnityObjectRef<Material>> materialsWithDuplicates, List<UnityObjectRef<Mesh>> meshesWithDuplicates)
    Parameters
    Type Name Description
    List<UnityObjectRef<Material>> materialsWithDuplicates

    The list of the materials.

    List<UnityObjectRef<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. The MaterialMeshIndices field is left to null.

    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. The MaterialMeshIndices field is left to null.

    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
    bool

    Returns true if the specified object is equal to the current object. Otherwise, returns false.

    Overrides
    ValueType.Equals(object)

    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
    bool

    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
    int

    The hash code.

    Overrides
    ValueType.GetHashCode()

    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.

    GetMaterials(MaterialMeshInfo)

    Gets the materials for given MaterialMeshInfo.

    Declaration
    public List<Material> GetMaterials(MaterialMeshInfo materialMeshInfo)
    Parameters
    Type Name Description
    MaterialMeshInfo materialMeshInfo

    The MaterialMeshInfo to use.

    Returns
    Type Description
    List<Material>

    Returns the associated material instances, 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

    operator ==(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
    bool

    True if left and right instances are equal and false otherwise.

    operator !=(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
    bool

    False if left and right instances are equal and true otherwise.

    Implements

    ISharedComponentData
    IQueryTypeParameter
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)