Skip to content

Commit

Permalink
properly set material mode on import so that material inspector does …
Browse files Browse the repository at this point in the history
…not override it
  • Loading branch information
hybridherbst committed Mar 15, 2021
1 parent 1cc8768 commit da0e606
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ public virtual AlphaMode AlphaMode
if (value == AlphaMode.MASK)
{
_material.SetOverrideTag("RenderType", "TransparentCutout");
_material.SetFloat("_Mode", 2);
_material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
_material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
_material.SetInt("_ZWrite", 1);
Expand All @@ -294,6 +295,7 @@ public virtual AlphaMode AlphaMode
else if (value == AlphaMode.BLEND)
{
_material.SetOverrideTag("RenderType", "Transparent");
_material.SetFloat("_Mode", 2);
_material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
_material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
_material.SetInt("_ZWrite", 0);
Expand All @@ -305,6 +307,7 @@ public virtual AlphaMode AlphaMode
else
{
_material.SetOverrideTag("RenderType", "Opaque");
_material.SetFloat("_Mode", 0);
_material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
_material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
_material.SetInt("_ZWrite", 1);
Expand Down

0 comments on commit da0e606

Please sign in to comment.