Search Unity

Changing blend mode with global keyword

Discussion in 'Shaders' started by TJHeuvel-net, Apr 5, 2017.

  1. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    I was wondering if its possible to use a different blend mode depending on whether a global keyword is set or not.

    It does seem like its possible with a property in the material (though poorly documented), but i'd really like to keep the same material. Any info is greatly appreciated!
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    No, it is not. Keywords can be used to change the shader variant, and shader variants can only change code inside the CGPROGRAM blocks. Further, global shader values cannot affect the blend mode either. The only way to do this is by setting the material properties directly (or maybe by using a MaterialPropertBlock on the renderer).
     
    NightmareS likes this.
  3. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Thanks for your reply!