Class MaterialUpgrader
Material Upgrader class.
Namespace: UnityEditor.Rendering
Syntax
public class MaterialUpgrader
Properties
NewShaderPath
Retrieves path to new shader.
Declaration
public string NewShaderPath { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Convert(Material, Material)
Custom material conversion method.
Declaration
public virtual void Convert(Material srcMaterial, Material dstMaterial)
Parameters
Type | Name | Description |
---|---|---|
Material | srcMaterial | Source material. |
Material | dstMaterial | Destination material. |
GetPropertyRenameMap(MaterialUpgrader.MaterialPropertyType)
Retrieves a collection of renamed parameters of a specific MaterialPropertyType.
Declaration
public IReadOnlyDictionary<string, string> GetPropertyRenameMap(MaterialUpgrader.MaterialPropertyType type)
Parameters
Type | Name | Description |
---|---|---|
MaterialUpgrader.MaterialPropertyType | type | Material Property Type |
Returns
Type | Description |
---|---|
IReadOnlyDictionary<String, String> | Dictionary of property names to their renamed values. |
Exceptions
Type | Condition |
---|---|
ArgumentException | type is not valid. |
RemoveTexture(String)
Remove Texture Parameter.
Declaration
public void RemoveTexture(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Parameter name. |
RenameColor(String, String)
Rename Color Parameter.
Declaration
public void RenameColor(string oldName, string newName)
Parameters
Type | Name | Description |
---|---|---|
String | oldName | Old name. |
String | newName | New name. |
RenameFloat(String, String)
Rename Float Parameter.
Declaration
public void RenameFloat(string oldName, string newName)
Parameters
Type | Name | Description |
---|---|---|
String | oldName | Old name. |
String | newName | New name. |
RenameKeywordToFloat(String, String, Single, Single)
Rename a keyword to float.
Declaration
public void RenameKeywordToFloat(string oldName, string newName, float setVal, float unsetVal)
Parameters
Type | Name | Description |
---|---|---|
String | oldName | Old name. |
String | newName | New name. |
Single | setVal | Value when set. |
Single | unsetVal | Value when unset. |
RenameShader(String, String, MaterialUpgrader.MaterialFinalizer)
Rename shader.
Declaration
public void RenameShader(string oldName, string newName, MaterialUpgrader.MaterialFinalizer finalizer = null)
Parameters
Type | Name | Description |
---|---|---|
String | oldName | Old name. |
String | newName | New name. |
MaterialUpgrader.MaterialFinalizer | finalizer | Finalizer delegate. |
RenameTexture(String, String)
Rename Texture Parameter.
Declaration
public void RenameTexture(string oldName, string newName)
Parameters
Type | Name | Description |
---|---|---|
String | oldName | Old name. |
String | newName | New name. |
SetColor(String, Color)
Set color property.
Declaration
public void SetColor(string propertyName, Color value)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Property name. |
Color | value | Property value. |
SetFloat(String, Single)
Set float property.
Declaration
public void SetFloat(string propertyName, float value)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Property name. |
Single | value | Property value. |
SetTexture(String, Texture)
Set texture property.
Declaration
public void SetTexture(string propertyName, Texture value)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Property name. |
Texture | value | Property value. |
Upgrade(Material, List<MaterialUpgrader>, MaterialUpgrader.UpgradeFlags)
Upgrade a material.
Declaration
public static void Upgrade(Material material, List<MaterialUpgrader> upgraders, MaterialUpgrader.UpgradeFlags flags)
Parameters
Type | Name | Description |
---|---|---|
Material | material | Material to upgrade. |
List<MaterialUpgrader> | upgraders | List of Material upgraders. |
MaterialUpgrader.UpgradeFlags | flags | Material Upgrader flags. |
Upgrade(Material, List<MaterialUpgrader>, MaterialUpgrader.UpgradeFlags, ref String)
Upgrade a material.
Declaration
public static bool Upgrade(Material material, List<MaterialUpgrader> upgraders, MaterialUpgrader.UpgradeFlags flags, ref string message)
Parameters
Type | Name | Description |
---|---|---|
Material | material | Material to upgrade. |
List<MaterialUpgrader> | upgraders | List of Material upgraders. |
MaterialUpgrader.UpgradeFlags | flags | Material upgrader flags. |
String | message | Error message to be outputted when no material upgraders are suitable for given material if the flags LogMessageWhenNoUpgraderFound is used. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the upgrader was found for the passed in material. |
Upgrade(Material, MaterialUpgrader, MaterialUpgrader.UpgradeFlags)
Upgrade a material.
Declaration
public static void Upgrade(Material material, MaterialUpgrader upgrader, MaterialUpgrader.UpgradeFlags flags)
Parameters
Type | Name | Description |
---|---|---|
Material | material | Material to upgrade. |
MaterialUpgrader | upgrader | Material upgrader. |
MaterialUpgrader.UpgradeFlags | flags | Material Upgrader flags. |
Upgrade(Material, MaterialUpgrader.UpgradeFlags)
Upgrade method.
Declaration
public void Upgrade(Material material, MaterialUpgrader.UpgradeFlags flags)
Parameters
Type | Name | Description |
---|---|---|
Material | material | Material to upgrade. |
MaterialUpgrader.UpgradeFlags | flags | Upgrade flag |
UpgradeProjectFolder(List<MaterialUpgrader>, HashSet<String>, String, MaterialUpgrader.UpgradeFlags)
Upgrade the project folder.
Declaration
public static void UpgradeProjectFolder(List<MaterialUpgrader> upgraders, HashSet<string> shaderNamesToIgnore, string progressBarName, MaterialUpgrader.UpgradeFlags flags = MaterialUpgrader.UpgradeFlags.None)
Parameters
Type | Name | Description |
---|---|---|
List<MaterialUpgrader> | upgraders | List of upgraders. |
HashSet<String> | shaderNamesToIgnore | Set of shader names to ignore. |
String | progressBarName | Name of the progress bar. |
MaterialUpgrader.UpgradeFlags | flags | Material Upgrader flags. |
UpgradeProjectFolder(List<MaterialUpgrader>, String, MaterialUpgrader.UpgradeFlags)
Upgrade the project folder.
Declaration
public static void UpgradeProjectFolder(List<MaterialUpgrader> upgraders, string progressBarName, MaterialUpgrader.UpgradeFlags flags = MaterialUpgrader.UpgradeFlags.None)
Parameters
Type | Name | Description |
---|---|---|
List<MaterialUpgrader> | upgraders | List of upgraders. |
String | progressBarName | Name of the progress bar. |
MaterialUpgrader.UpgradeFlags | flags | Material Upgrader flags. |
UpgradeSelection(List<MaterialUpgrader>, HashSet<String>, String, MaterialUpgrader.UpgradeFlags)
Upgrade the selection.
Declaration
public static void UpgradeSelection(List<MaterialUpgrader> upgraders, HashSet<string> shaderNamesToIgnore, string progressBarName, MaterialUpgrader.UpgradeFlags flags = MaterialUpgrader.UpgradeFlags.None)
Parameters
Type | Name | Description |
---|---|---|
List<MaterialUpgrader> | upgraders | List of upgraders. |
HashSet<String> | shaderNamesToIgnore | Set of shader names to ignore. |
String | progressBarName | Name of the progress bar. |
MaterialUpgrader.UpgradeFlags | flags | Material Upgrader flags. |
UpgradeSelection(List<MaterialUpgrader>, String, MaterialUpgrader.UpgradeFlags)
Upgrade the selection.
Declaration
public static void UpgradeSelection(List<MaterialUpgrader> upgraders, string progressBarName, MaterialUpgrader.UpgradeFlags flags = MaterialUpgrader.UpgradeFlags.None)
Parameters
Type | Name | Description |
---|---|---|
List<MaterialUpgrader> | upgraders | List of upgraders. |
String | progressBarName | Name of the progress bar. |
MaterialUpgrader.UpgradeFlags | flags | Material Upgrader flags. |