docs.unity3d.com
    Show / Hide Table of Contents

    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
    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
    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
    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.

    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.


    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Constructors
      • RenderMeshArray(Material[], Mesh[])
    • Properties
      • Materials
      • Meshes
    • Methods
      • CombineRenderMeshArrays(List<RenderMeshArray>)
      • CombineRenderMeshes(List<RenderMesh>)
      • ComputeHash128()
      • CreateWithDeduplication(List<Material>, List<Mesh>)
      • Equals(Object)
      • Equals(RenderMeshArray)
      • GetHash128()
      • GetHashCode()
      • GetMaterial(MaterialMeshInfo)
      • GetMesh(MaterialMeshInfo)
      • ResetHash128()
    • Operators
      • Equality(RenderMeshArray, RenderMeshArray)
      • Inequality(RenderMeshArray, RenderMeshArray)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023