Class MaterialUtils
Runtime Material utilities
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 |