Search Unity

Best way to swap shaders from custom GUI

Discussion in 'Shaders' started by GearKlik, Jul 21, 2017.

  1. GearKlik

    GearKlik

    Joined:
    Sep 21, 2015
    Posts:
    58
    I'm creating a Ghost shader that has an option to write to Z buffer on the first pass then color on second pass. Option is set in custom shader GUI.

    1. Can someone confirm there's no way to enable/disable shader passes? I don't think you can but want to make sure.

    2. I did a test and I can swap shader files in the custom GUI which effectually enables/disables passes (one shader has a pass, the other doesn't). Any drawbacks to this approach?

    3. For 2 to work, the separate shader's ShaderLab properties need to be the same. Is there any way to include an external shared block of shaderLab properties?

    TNKS!

    G