docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MaterialUpgrader

    Material Upgrader class.

    Inheritance
    object
    MaterialUpgrader
    SpeedTree8MaterialUpgrader
    SpeedTree9MaterialUpgrader
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.Rendering
    Assembly: Unity.RenderPipelines.Core.Editor.dll
    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(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.

    ProjectFolderContainsNonBuiltinMaterials(List<MaterialUpgrader>)

    Checking if project folder contains any materials that are not using built-in shaders.

    Declaration
    public static bool ProjectFolderContainsNonBuiltinMaterials(List<MaterialUpgrader> upgraders)
    Parameters
    Type Name Description
    List<MaterialUpgrader> upgraders

    List if MaterialUpgraders

    Returns
    Type Description
    bool

    Returns true if at least one material uses a non-built-in shader (ignores Hidden, HDRP and Shader Graph Shaders)

    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, float, float)

    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.

    float setVal

    Value when set.

    float unsetVal

    Value when unset.

    RenameShader(string, string, 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, float)

    Set float property.

    Declaration
    public void SetFloat(string propertyName, float value)
    Parameters
    Type Name Description
    string propertyName

    Property name.

    float 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>, 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>, 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
    bool

    Returns true if the upgrader was found for the passed in material.

    Upgrade(Material, 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, 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, UpgradeFlags)

    Upgrade the project folder.

    Declaration
    public static void UpgradeProjectFolder(List<MaterialUpgrader> upgraders, HashSet<string> shaderNamesToIgnore, string progressBarName, MaterialUpgrader.UpgradeFlags flags = 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, UpgradeFlags)

    Upgrade the project folder.

    Declaration
    public static void UpgradeProjectFolder(List<MaterialUpgrader> upgraders, string progressBarName, MaterialUpgrader.UpgradeFlags flags = 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, UpgradeFlags)

    Upgrade the selection.

    Declaration
    public static void UpgradeSelection(List<MaterialUpgrader> upgraders, HashSet<string> shaderNamesToIgnore, string progressBarName, MaterialUpgrader.UpgradeFlags flags = 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, UpgradeFlags)

    Upgrade the selection.

    Declaration
    public static void UpgradeSelection(List<MaterialUpgrader> upgraders, string progressBarName, MaterialUpgrader.UpgradeFlags flags = 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.

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)