Leaking uniforms and macros needs to be addressed

I could submit a bug report but this is the second time I have come across this so a post needs to be made.

The macros highlighted above leak. If anyone uses any of these names in their shaders in latest 2022.3 and have Light Probe System set to Probe Volumes, they will be replaced. For example, I have a struct with a member called _Weight and the macro with the same name replaced it causing a compilation error. A workaround for now is to #undef _Weight.

My first encounter with a similar problem was with the HDRP Water System which was leaking all of its uniforms (ie not namespaced) like _FoamSmoothness causing conflicts.

From a quality assurance perspective, what will Unity do to ensure that these sorts of problems no longer happens?

Hey, sorry about that i’ll fix it
It’s unfortnately very hard to catch these as we want these variables to be leaking in the global space, we just have to make sure thay don’t have a name that is likely to be used in projects. In this case i’ll prefix them all with APV, but i don’t see how we can catch that automatically

Thank you. I am just concerned that this is going to become endemic. Static analysis is an option or having a strict policy of prefixing with Unity. Wouldn’t they normally be prefixed with Unity?

technically all of our code is ‘leaking’ in global space, but that’s how hlsl with #include works, static analysis here wouldn’t help as it would just highlight evrything. So we would have to prefix every single function/variable in all of our shaders which is too much work to be reasonable

I know… Anyway, thank you again for fixing both of those problems.