LIGHT_ATTENUATION becomes UNITY_LIGHT_ATTENUATION in 2018.1

All my ShaderForge generated shaders broke after upgrading to 2018.1. The reason, it turns out, is the change from the LIGHT_ATTENUATION() macro (back in Unity 5) to now UNITY_LIGHT_ATTENUATION(), which was made final in 2018.1. So just rename all your instances and the shaders should work again.

2 thoughts to “LIGHT_ATTENUATION becomes UNITY_LIGHT_ATTENUATION in 2018.1”

  1. It appears the new UNITY_LIGHT_ATTENUATION macro takes extra arguments. Having trouble converting…

    1. These are the macro definitions I found in the unity built-in shaders, so it seems like yes, the definition and parameter count has changed.

      Previously:

      Now:

      destName is the target variable the attenuation will be written into. input should be your v2f struct. worldPos is the world position which is something you should have in your v2f struct as a variable.

Leave a Reply

Your email address will not be published. Required fields are marked *

I confirm