Class UIMaterialInstantiator
This is required since UnityUI Graphic elements do not support MaterialPropertyBlocks, and any shader operations can end up modifying the material permanently across all shared instances. To prevent that we create a runtime copy of the material.
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.UI
Assembly: cs.temp.dll.dll
Syntax
public class UIMaterialInstantiator
Methods
TryCreateMaterialCopy(Graphic)
Invoke this method to create a copy of the material and use that copy at runtime for Graphic objects to prevent modifying materials in editor or impact shared materials.
Declaration
public static void TryCreateMaterialCopy(Graphic targetGraphic)
Parameters
Type | Name | Description |
---|---|---|
Graphic | targetGraphic | Graphic element that needs to clone its material |
TryCreateMaterialCopy(Graphic)
Invoke this method to create a copy of the material and use that copy at runtime for Graphic objects to prevent modifying materials in editor or impact shared materials.
Declaration
public static void TryCreateMaterialCopy(Graphic targetGraphic)
Parameters
Type | Name | Description |
---|---|---|
Graphic | targetGraphic | Graphic element that needs to clone its material |