docs.unity3d.com
    Show / Hide Table of Contents

    Class MaterialUtils

    Runtime Material utilities

    Inheritance
    Object
    MaterialUtils
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.XR.CoreUtils
    Syntax
    public static class MaterialUtils

    Methods

    AddMaterial(Renderer, Material)

    Add a material to this renderer's shared materials

    Declaration
    public static void AddMaterial(this Renderer renderer, Material material)
    Parameters
    Type Name Description
    Renderer renderer

    The renderer on which to add the material

    Material material

    The material to be added

    CloneMaterials(Renderer)

    Clone all materials within a renderer; IMPORTANT: Make sure to call UnityObjectUtils.Destroy() on this material when done!

    Declaration
    public static Material[] CloneMaterials(Renderer renderer)
    Parameters
    Type Name Description
    Renderer renderer

    Renderer that will have its materials cloned and replaced

    Returns
    Type Description
    Material[]

    Cloned materials

    GetMaterialClone(Renderer)

    Get a material clone; IMPORTANT: Make sure to call UnityObjectUtils.Destroy() on this material when done!

    Declaration
    public static Material GetMaterialClone(Renderer renderer)
    Parameters
    Type Name Description
    Renderer renderer

    Renderer that will have its material clone and replaced

    Returns
    Type Description
    Material

    Cloned material

    HexToColor(String)

    Convert a formatted hex string to a Color

    Declaration
    public static Color HexToColor(string hex)
    Parameters
    Type Name Description
    String hex

    The formatted string, with an optional 0x or # prefix

    Returns
    Type Description
    Color

    The color value represented by the formatted string

    HueShift(Color, Single)

    Shift the hue of a color by a given amount

    Declaration
    public static Color HueShift(Color color, float shift)
    Parameters
    Type Name Description
    Color color

    The input color

    Single shift

    The amount of shift

    Returns
    Type Description
    Color

    The output color

    Back to top
    Terms of use
    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