当前位置: 首页>>代码示例>>C#>>正文


C# Material.SetOverrideTag方法代码示例

本文整理汇总了C#中UnityEngine.Material.SetOverrideTag方法的典型用法代码示例。如果您正苦于以下问题:C# Material.SetOverrideTag方法的具体用法?C# Material.SetOverrideTag怎么用?C# Material.SetOverrideTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Material的用法示例。


在下文中一共展示了Material.SetOverrideTag方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetMaterialRenderingMode

    public static void SetMaterialRenderingMode(Material material, StandardShaderRenderingMode mode)
    {
        switch (mode)
        {
        case StandardShaderRenderingMode.Opaque:
            material.SetOverrideTag("RenderType", "");
            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
            material.SetInt("_ZWrite", 1);
            material.DisableKeyword("_ALPHATEST_ON");
            material.DisableKeyword("_ALPHABLEND_ON");
            material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
            material.renderQueue = -1;
            break;

        case StandardShaderRenderingMode.Cutout:
            material.SetOverrideTag("RenderType", "TransparentCutout");
            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
            material.SetInt("_ZWrite", 1);
            material.EnableKeyword("_ALPHATEST_ON");
            material.DisableKeyword("_ALPHABLEND_ON");
            material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
            material.renderQueue = 2450;
            break;

        case StandardShaderRenderingMode.Fade:
            material.SetOverrideTag("RenderType", "Transparent");
            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
            material.SetInt("_ZWrite", 0);
            material.DisableKeyword("_ALPHATEST_ON");
            material.EnableKeyword("_ALPHABLEND_ON");
            material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
            material.renderQueue = 3000;
            break;

        case StandardShaderRenderingMode.Transparent:
            material.SetOverrideTag("RenderType", "Transparent");
            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
            material.SetInt("_ZWrite", 0);
            material.DisableKeyword("_ALPHATEST_ON");
            material.DisableKeyword("_ALPHABLEND_ON");
            material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
            material.renderQueue = 3000;
            break;
        }
    }
开发者ID:jawa0,项目名称:JabaUnityScripts,代码行数:49,代码来源:JAShaderUtils.cs

示例2: SetTransparent

 public static void SetTransparent(Material material)
 {
     material.SetOverrideTag("RenderType", "Transparent");
     material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
     material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
     material.SetInt("_ZWrite", 0);
     material.DisableKeyword("_ALPHATEST_ON");
     material.DisableKeyword("_ALPHABLEND_ON");
     material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
     material.renderQueue = 3000;
 }
开发者ID:TomorrowTodayLabs,项目名称:VRInteraction,代码行数:11,代码来源:VRIHelpers.cs

示例3: SetOpaque

 public static void SetOpaque(Material material)
 {
     material.SetOverrideTag("RenderType", "");
     material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
     material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
     material.SetInt("_ZWrite", 1);
     material.DisableKeyword("_ALPHATEST_ON");
     material.DisableKeyword("_ALPHABLEND_ON");
     material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
     material.renderQueue = -1;
 }
开发者ID:apekshadarbari,项目名称:PokerFace,代码行数:11,代码来源:NVRHelpers.cs

示例4: SetOpaque

        public static void SetOpaque(Material material)
        {
            if (material.shader != StandardShader)
                Debug.LogWarning("Trying to set opaque mode on non-standard shader. Please use the Standard Shader instead or modify this method.");

            material.SetOverrideTag("RenderType", "");
            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
            material.SetInt("_ZWrite", 1);
            material.DisableKeyword("_ALPHATEST_ON");
            material.DisableKeyword("_ALPHABLEND_ON");
            material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
            material.renderQueue = -1;
        }
开发者ID:Cratesmith,项目名称:NewtonVR,代码行数:14,代码来源:NVRHelpers.cs

示例5: SetTransparent

        public static void SetTransparent(Material material, Color? newcolor = null)
        {
            material.SetOverrideTag("RenderType", "Transparent");
            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
            material.SetInt("_ZWrite", 0);
            material.DisableKeyword("_ALPHATEST_ON");
            material.DisableKeyword("_ALPHABLEND_ON");
            material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
            material.SetFloat("_Metallic", 0f);
            material.SetFloat("_Glossiness", 0f);
            material.renderQueue = 3000;
            material.mainTexture = null;

            if (newcolor != null)
            {
                material.color = newcolor.Value;
            }
        }
开发者ID:apekshadarbari,项目名称:PokerFace,代码行数:19,代码来源:NVRHelpers.cs

示例6: SetTransparent

        public static void SetTransparent(Material material, Color? newcolor = null)
        {
            if (material.shader != StandardShader)
                Debug.LogWarning("Trying to set transparent mode on non-standard shader. Please use the Standard Shader instead or modify this method.");

            material.SetOverrideTag("RenderType", "Transparent");
            material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
            material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
            material.SetInt("_ZWrite", 0);
            material.DisableKeyword("_ALPHATEST_ON");
            material.DisableKeyword("_ALPHABLEND_ON");
            material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
            material.SetFloat("_Metallic", 0f);
            material.SetFloat("_Glossiness", 0f);
            material.renderQueue = 3000;
            material.mainTexture = null;

            if (newcolor != null)
            {
                material.color = newcolor.Value;
            }
        }
开发者ID:Cratesmith,项目名称:NewtonVR,代码行数:22,代码来源:NVRHelpers.cs

示例7: SetupMaterialWithBlendMode

        public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
        {
            switch (blendMode)
            {
                case BlendMode.Opaque:
                    material.SetOverrideTag("RenderType", "");
                    material.SetInt("_SrcBlend", 1);
                    material.SetInt("_DstBlend", 0);
                    material.SetInt("_ZWrite", 1);
                    material.DisableKeyword("_ALPHATEST_ON");
                    material.DisableKeyword("_ALPHABLEND_ON");
                    material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = -1;
                    break;

                case BlendMode.Cutout:
                    material.SetOverrideTag("RenderType", "TransparentCutout");
                    material.SetInt("_SrcBlend", 1);
                    material.SetInt("_DstBlend", 0);
                    material.SetInt("_ZWrite", 1);
                    material.EnableKeyword("_ALPHATEST_ON");
                    material.DisableKeyword("_ALPHABLEND_ON");
                    material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = 0x992;
                    break;

                case BlendMode.Fade:
                    material.SetOverrideTag("RenderType", "Transparent");
                    material.SetInt("_SrcBlend", 5);
                    material.SetInt("_DstBlend", 10);
                    material.SetInt("_ZWrite", 0);
                    material.DisableKeyword("_ALPHATEST_ON");
                    material.EnableKeyword("_ALPHABLEND_ON");
                    material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = 0xbb8;
                    break;

                case BlendMode.Transparent:
                    material.SetOverrideTag("RenderType", "Transparent");
                    material.SetInt("_SrcBlend", 1);
                    material.SetInt("_DstBlend", 10);
                    material.SetInt("_ZWrite", 0);
                    material.DisableKeyword("_ALPHATEST_ON");
                    material.DisableKeyword("_ALPHABLEND_ON");
                    material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = 0xbb8;
                    break;
            }
        }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:49,代码来源:StandardShaderGUI.cs

示例8: SetRenderQueue

	static void SetRenderQueue (Material material, string queue) {
		bool meshNormal = true;

		if (material.HasProperty("_FixedNormal")) {
			bool fixedNormals = material.IsKeywordEnabled(_FIXED_NORMALS);
			bool fixedNormalsBackRendering = material.IsKeywordEnabled(_FIXED_NORMALS_BACK_RENDERING);
			meshNormal = !fixedNormals && !fixedNormalsBackRendering;
		}

		material.SetOverrideTag("RenderType", meshNormal ? queue : "Sprite");
	}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:11,代码来源:SpineSpriteShaderGUI.cs

示例9: SetupMaterialWithBlendMode

 public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
 {
     switch (blendMode)
     {
     case BlendMode.Opaque:
         material.SetOverrideTag("RenderType", "");
         material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
         material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
         material.SetInt("_ZWrite", 1);
         material.SetFloat( "_FogMultiplier", 1.0f );
         material.DisableKeyword("_ALPHATEST_ON");
         material.DisableKeyword("_ALPHABLEND_ON");
         material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
         material.renderQueue = -1;
         break;
     case BlendMode.AlphaTest:
         material.SetOverrideTag("RenderType", "TransparentCutout");
         material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
         material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
         material.SetInt("_ZWrite", 1);
         material.SetFloat( "_FogMultiplier", 1.0f );
         material.EnableKeyword("_ALPHATEST_ON");
         material.DisableKeyword("_ALPHABLEND_ON");
         material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
         material.renderQueue = 2450;
         break;
     case BlendMode.AlphaBlend:
         material.SetOverrideTag("RenderType", "Transparent");
         material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
         material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
         material.SetInt("_ZWrite", 0);
         material.SetFloat( "_FogMultiplier", 1.0f );
         material.DisableKeyword("_ALPHATEST_ON");
         material.EnableKeyword("_ALPHABLEND_ON");
         material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
         material.renderQueue = 3000;
         break;
     case BlendMode.Glass:
         material.SetOverrideTag("RenderType", "Transparent");
         material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
         material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
         material.SetInt("_ZWrite", 0);
         material.SetFloat( "_FogMultiplier", 1.0f );
         material.DisableKeyword("_ALPHATEST_ON");
         material.DisableKeyword("_ALPHABLEND_ON");
         material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
         material.renderQueue = 3000;
         break;
     case BlendMode.Additive:
         material.SetOverrideTag( "RenderType", "Transparent" );
         material.SetInt( "_SrcBlend", ( int )UnityEngine.Rendering.BlendMode.One );
         material.SetInt( "_DstBlend", ( int )UnityEngine.Rendering.BlendMode.One );
         material.SetInt( "_ZWrite", 0 );
         material.SetFloat( "_FogMultiplier", 0.0f );
         material.DisableKeyword( "_ALPHATEST_ON" );
         material.DisableKeyword( "_ALPHABLEND_ON" );
         material.DisableKeyword( "_ALPHAPREMULTIPLY_ON" );
         material.renderQueue = 3000;
         break;
     }
 }
开发者ID:CAOakleyII,项目名称:vive-project,代码行数:61,代码来源:ValveShaderGUI.cs

示例10: SetupMaterialWithBlendMode

 public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
 {
     switch (blendMode)
     {
         case BlendMode.Opaque:
             material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
             material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
             material.SetInt("_ZWrite", 1);
             material.DisableKeyword("_ALPHATEST_ON");
             material.DisableKeyword("_ALPHABLEND_ON");
             material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
             material.renderQueue = -1;
             break;
         case BlendMode.Cutout:
             material.SetOverrideTag("RenderType", "TransparentCutout");
             material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
             material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
             material.SetInt("_ZWrite", 1);
             material.EnableKeyword("_ALPHATEST_ON");
             material.DisableKeyword("_ALPHABLEND_ON");
             material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
             material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
             break;
         case BlendMode.Fade:
             material.SetOverrideTag("RenderType", "Transparent");
             material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
             material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
             material.SetInt("_ZWrite", 0);
             material.DisableKeyword("_ALPHATEST_ON");
             material.EnableKeyword("_ALPHABLEND_ON");
             material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
             material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
             break;
         case BlendMode.Transparent:
             material.SetOverrideTag("RenderType", "Transparent");
             material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
             material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
             material.SetInt("_ZWrite", 0);
             material.DisableKeyword("_ALPHATEST_ON");
             material.DisableKeyword("_ALPHABLEND_ON");
             material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
             material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
             break;
     }
 }
开发者ID:TwoClunkers,项目名称:Clunk-Genesis,代码行数:45,代码来源:StandardShaderVCGUI.cs

示例11: SetupMaterialWithBlendMode

 public static void SetupMaterialWithBlendMode(Material material, StandardShaderGUI.BlendMode blendMode)
 {
   switch (blendMode)
   {
     case StandardShaderGUI.BlendMode.Opaque:
       material.SetOverrideTag("RenderType", string.Empty);
       material.SetInt("_SrcBlend", 1);
       material.SetInt("_DstBlend", 0);
       material.SetInt("_ZWrite", 1);
       material.DisableKeyword("_ALPHATEST_ON");
       material.DisableKeyword("_ALPHABLEND_ON");
       material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
       material.renderQueue = -1;
       break;
     case StandardShaderGUI.BlendMode.Cutout:
       material.SetOverrideTag("RenderType", "TransparentCutout");
       material.SetInt("_SrcBlend", 1);
       material.SetInt("_DstBlend", 0);
       material.SetInt("_ZWrite", 1);
       material.EnableKeyword("_ALPHATEST_ON");
       material.DisableKeyword("_ALPHABLEND_ON");
       material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
       material.renderQueue = 2450;
       break;
     case StandardShaderGUI.BlendMode.Fade:
       material.SetOverrideTag("RenderType", "Transparent");
       material.SetInt("_SrcBlend", 5);
       material.SetInt("_DstBlend", 10);
       material.SetInt("_ZWrite", 0);
       material.DisableKeyword("_ALPHATEST_ON");
       material.EnableKeyword("_ALPHABLEND_ON");
       material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
       material.renderQueue = 3000;
       break;
     case StandardShaderGUI.BlendMode.Transparent:
       material.SetOverrideTag("RenderType", "Transparent");
       material.SetInt("_SrcBlend", 1);
       material.SetInt("_DstBlend", 10);
       material.SetInt("_ZWrite", 0);
       material.DisableKeyword("_ALPHATEST_ON");
       material.DisableKeyword("_ALPHABLEND_ON");
       material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
       material.renderQueue = 3000;
       break;
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:46,代码来源:StandardShaderGUI.cs

示例12: SetBlendMode

        /// <summary>
        /// Change the blend mode of a Standard material at runtime.
        /// </summary>
        public static void SetBlendMode(
            Material material,
            CustomBlendMode blendMode,
            CustomSmoothnessMapChannel smoothnessChannel,
            float metallic,
            float glossiness)
        {
            // Set properties
            material.SetFloat("_Mode", (int)blendMode);
            material.SetFloat("_SmoothnessTextureChannel", (int)smoothnessChannel);
            material.SetFloat("_Metallic", metallic);
            material.SetFloat("_Glossiness", glossiness);

            switch (blendMode)
            {
                case CustomBlendMode.Opaque:
                    material.SetOverrideTag("RenderType", "");
                    material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
                    material.SetInt("_ZWrite", 1);
                    material.DisableKeyword("_ALPHATEST_ON");
                    material.DisableKeyword("_ALPHABLEND_ON");
                    material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = -1;
                    break;
                case CustomBlendMode.Cutout:
                    material.SetOverrideTag("RenderType", "TransparentCutout");
                    material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
                    material.SetInt("_ZWrite", 1);
                    material.EnableKeyword("_ALPHATEST_ON");
                    material.DisableKeyword("_ALPHABLEND_ON");
                    material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
                    break;
                case CustomBlendMode.Fade:
                    material.SetOverrideTag("RenderType", "Transparent");
                    material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
                    material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                    material.SetInt("_ZWrite", 0);
                    material.DisableKeyword("_ALPHATEST_ON");
                    material.EnableKeyword("_ALPHABLEND_ON");
                    material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
                    break;
                case CustomBlendMode.Transparent:
                    material.SetOverrideTag("RenderType", "Transparent");
                    material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                    material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                    material.SetInt("_ZWrite", 0);
                    material.DisableKeyword("_ALPHATEST_ON");
                    material.DisableKeyword("_ALPHABLEND_ON");
                    material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
                    material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
                    break;
            }
        }
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:60,代码来源:MaterialReader.cs

示例13: StandardToValveSingleMaterial

    //---------------------------------------------------------------------------------------------------------------------------------------------------
    public static bool StandardToValveSingleMaterial( Material m, Shader srcShader, Shader destShader, bool bRecordUnknownShaders, List<string> unknownShaders )
    {
        string n = srcShader.name;

        if ( n.Equals( destShader.name ) )
        {
            // Do nothing
            //Debug.Log( "     Skipping " + m.name + "\n" );
            return false;
        }
        else if ( n.Equals( "Standard" ) || n.Equals( "Valve/VR/Standard" ) )
        {
            // Metallic specular
            Debug.Log( "     Converting from \"" + n + "\"-->\"" + destShader.name + "\": " + m.name + "\n" );

            m.shader = destShader;
            m.SetOverrideTag( "OriginalShader", n );

            m.SetInt( "_SpecularMode", 2 );
            m.DisableKeyword( "S_SPECULAR_NONE" );
            m.DisableKeyword( "S_SPECULAR_BLINNPHONG" );
            m.EnableKeyword( "S_SPECULAR_METALLIC" );
            return true;
        }
        else if ( n.Equals( "Standard (Specular setup)" ) || n.Equals( "Legacy Shaders/Bumped Diffuse" ) || n.Equals( "Legacy Shaders/Transparent/Diffuse" ) )
        {
            // Regular specular
            Debug.Log( "     Converting from \"" + n + "\"-->\"" + destShader.name + "\": " + m.name + "\n" );

            m.shader = destShader;
            m.SetOverrideTag( "OriginalShader", n );

            m.SetInt( "_SpecularMode", 1 );
            m.DisableKeyword( "S_SPECULAR_NONE" );
            m.EnableKeyword( "S_SPECULAR_BLINNPHONG" );
            m.DisableKeyword( "S_SPECULAR_METALLIC" );

            if ( n.Equals( "Legacy Shaders/Transparent/Diffuse" ) )
            {
                m.SetFloat( "_Mode", 2 );
                m.SetOverrideTag( "RenderType", "Transparent" );
                m.SetInt( "_SrcBlend", ( int )UnityEngine.Rendering.BlendMode.SrcAlpha );
                m.SetInt( "_DstBlend", ( int )UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha );
                m.SetInt( "_ZWrite", 0 );
                m.DisableKeyword( "_ALPHATEST_ON" );
                m.EnableKeyword( "_ALPHABLEND_ON" );
                m.DisableKeyword( "_ALPHAPREMULTIPLY_ON" );
                m.renderQueue = 3000;
            }
            return true;
        }
        else if ( n.Equals( "Unlit/Color" ) || n.Equals( "Unlit/Texture" ) || n.Equals( "Unlit/Transparent" ) || n.Equals( "Unlit/Transparent Cutout" ) )
        {
            // Unlit
            Debug.Log( "     Converting from \"" + n + "\"-->\"" + destShader.name + "\": " + m.name + "\n" );

            m.shader = destShader;
            m.SetOverrideTag( "OriginalShader", n );
            m.SetInt( "g_bUnlit", 1 );
            m.EnableKeyword( "S_UNLIT" );

            m.SetColor( "_EmissionColor", Color.black );

            if ( n.Equals( "Unlit/Color" ) )
            {
                m.SetTexture( "_MainTex", Texture2D.whiteTexture );
            }
            else
            {
                m.SetColor( "_Color", Color.white );

                if ( n.Equals( "Unlit/Transparent Cutout" ) )
                {
                    m.SetFloat( "_Mode", 1 );
                    m.SetOverrideTag( "RenderType", "TransparentCutout" );
                    m.SetInt( "_SrcBlend", ( int )UnityEngine.Rendering.BlendMode.One );
                    m.SetInt( "_DstBlend", ( int )UnityEngine.Rendering.BlendMode.Zero );
                    m.SetInt( "_ZWrite", 1 );
                    m.EnableKeyword( "_ALPHATEST_ON" );
                    m.DisableKeyword( "_ALPHABLEND_ON" );
                    m.DisableKeyword( "_ALPHAPREMULTIPLY_ON" );
                    m.renderQueue = 2450;
                }
                else if ( n.Equals( "Unlit/Transparent" ) )
                {
                    m.SetFloat( "_Mode", 2 );
                    m.SetOverrideTag( "RenderType", "Transparent" );
                    m.SetInt( "_SrcBlend", ( int )UnityEngine.Rendering.BlendMode.SrcAlpha );
                    m.SetInt( "_DstBlend", ( int )UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha );
                    m.SetInt( "_ZWrite", 0 );
                    m.DisableKeyword( "_ALPHATEST_ON" );
                    m.EnableKeyword( "_ALPHABLEND_ON" );
                    m.DisableKeyword( "_ALPHAPREMULTIPLY_ON" );
                    m.renderQueue = 3000;
                }
            }

            return true;
        }
//.........这里部分代码省略.........
开发者ID:CAOakleyII,项目名称:vive-project,代码行数:101,代码来源:ValveMenuTools.cs


注:本文中的UnityEngine.Material.SetOverrideTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。