docs.unity3d.com
    Show / Hide Table of Contents

    Struct MaterialMeshInfo

    Represents which materials and meshes to use to render an entity.

    Namespace: Unity.Rendering
    Syntax
    public struct MaterialMeshInfo : IComponentData, IQueryTypeParameter
    Remarks

    This struct supports both a serializable static encoding in which case Material and Mesh are array indices to some array (typically a RenderMeshArray), and direct use of runtime BatchRendererGroup BatchMaterialID / BatchMeshID values.

    Constructors

    MaterialMeshInfo(BatchMaterialID, BatchMeshID, SByte)

    Creates an instance of MaterialMeshInfo from material and mesh/sub-mesh IDs registered with EntitiesGraphicsSystem

    Declaration
    public MaterialMeshInfo(BatchMaterialID materialID, BatchMeshID meshID, sbyte submeshIndex = 0)
    Parameters
    Type Name Description
    BatchMaterialID materialID

    The material ID from RegisterMaterial(Material).

    BatchMeshID meshID

    The mesh ID from RegisterMesh(Mesh).

    SByte submeshIndex

    An optional submesh ID.

    Fields

    Material

    The material ID.

    Declaration
    public int Material
    Field Value
    Type Description
    Int32

    Mesh

    The mesh ID.

    Declaration
    public int Mesh
    Field Value
    Type Description
    Int32

    Submesh

    The sub-mesh ID.

    Declaration
    public sbyte Submesh
    Field Value
    Type Description
    SByte

    Properties

    MaterialID

    The material ID property.

    Declaration
    public BatchMaterialID MaterialID { get; set; }
    Property Value
    Type Description
    BatchMaterialID

    MeshID

    The mesh ID property.

    Declaration
    public BatchMeshID MeshID { get; set; }
    Property Value
    Type Description
    BatchMeshID

    Methods

    ArrayIndexToStaticIndex(Int32)

    Converts the given array index (typically the index inside RenderMeshArray) into a negative number that denotes that array position.

    Declaration
    public static int ArrayIndexToStaticIndex(int index)
    Parameters
    Type Name Description
    Int32 index

    The index to convert.

    Returns
    Type Description
    Int32

    Returns the converted index.

    FromRenderMeshArrayIndices(Int32, Int32, SByte)

    Creates an instance of MaterialMeshInfo from material and mesh/sub-mesh indices in the corresponding RenderMeshArray.

    Declaration
    public static MaterialMeshInfo FromRenderMeshArrayIndices(int materialIndexInRenderMeshArray, int meshIndexInRenderMeshArray, sbyte submeshIndex = 0)
    Parameters
    Type Name Description
    Int32 materialIndexInRenderMeshArray

    The material index in Materials.

    Int32 meshIndexInRenderMeshArray

    The mesh index in Meshes.

    SByte submeshIndex

    An optional submesh ID.

    Returns
    Type Description
    MaterialMeshInfo

    Returns the MaterialMeshInfo instance that contains the material and mesh indices.

    StaticIndexToArrayIndex(Int32)

    Converts the given static index (a negative value) to a valid array index.

    Declaration
    public static int StaticIndexToArrayIndex(int staticIndex)
    Parameters
    Type Name Description
    Int32 staticIndex

    The index to convert.

    Returns
    Type Description
    Int32

    Returns the converted index.

    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