Search Unity

Enable/Disable Blending state in shader using properties

Discussion in 'Shaders' started by CorruptScanline, Feb 23, 2014.

  1. CorruptScanline


    Mar 26, 2009
    Id like to be able to completely enable/disable blending per material, similar to the way you can change the blendmode through properties now. I have created a feature request with more info here:

    Perhaps I'm missing something though, and this can be done, or maybe theres a workaround? I guess one option would be to use AssetPostProcessor to maintain duplicate versions, but thats not very clean.
  2. mayorc1978


    Dec 30, 2013
    You are using MULTICOMPILE, and the blending can be modified inside the CG Program so yes, you should be able to modify this behaviour per material without the need to switching shader.
    Using a simple toggle Button or in this case (as shown in your feedback request) an EnumPopup.

    You must use a Custom Material Editor:
    You can read how to here:

    EDIT: Actually reading back what you asked this might not be possible, as your #if/#endif groups have #pragmas in the middle, I don't think this will work with other preprocessor directives.
    But you could give it a try.
    Last edited: Feb 25, 2014