Changing .cginc files

How do we go about modifying built-in cginc files for a single project?

Doing it through the install directory isn’t an option for a number of reasons, so I’ve downloaded the built-in shaders and imported them into my project (cgincludes and all) to the directory: Shaders/Resources/Unity Core/

Now they they’re in my project, I’m assuming all the native shaders (like Standard, Mobile/…, Nature/…, etc.) are now building off of the shader files in my project directory, no longer my install directory.

Suppose now I want to change the .cginc files that the new standard shader references. I’ve tried going in and making some changes to see if it works (returning literal debug values instead of calculating things) but it doesn’t seem to be working.

For example, I go into /Shaders/Resources/Unity Core/CGIncludes/UnityPBSLighting.cginc and change LightingStandard(…) to always return yellow. I expect all my objects using the default surface shader to show up yellow under any kind of light. This isn’t the case however, they work the same as if I never modified the shader.

inline half4 LightingStandard (SurfaceOutputStandard s, half3 viewDir, UnityGI gi)
{
    return half4 (1, 1, 0, 1);
    . . .

I’ve even put in broken code to see if it’s getting compiled. It doesn’t look like it is.

Any thoughts?

Looks like I may have resolved it.

It looks like Unity checks within the same directory as the shader, (this includes generated surface shaders which was throwing me off), for the required cginc files, then, if it can’t find them, it goes to the install directory.

Unfortunately, this means I need to keep all my shaders and .cginc files in the same directory. In other words, I have to take all the built-in shader files which are normally split into 4 directories and more subdirectories, and put them into a single directory. If I want any new shaders to use the modified core .cginc files, I have to stick them there too.

This could get messy…

Further possible solution: How to specify my CGIncludes directories? - Questions & Answers - Unity Discussions