Custom cginc relative to Assets folder in DX11

When I included a cginc in a shader, I used to supply the position relative to the Assets folder.

#include "Assets/WaterSim/Shaders/HeightmapSurface.cginc"

Which worked fine, until I switched to Unity 4, where compiling for DirectX 11 resulted in these warnings:

Shader warning in 'WaterSimulation/ForceErosion': Program 'vert', failed to open source file: 'Assets/WaterSim/Shaders/HeightmapSurface.cginc' (compiling for d3d11) at line 59
Shader warning in 'WaterSimulation/ForceErosion': Program 'vert', failed to open source file: 'Assets/WaterSim/Shaders/HeightmapSurface.cginc' (compiling for d3d11_9x) at line 59

Using paths that are relative to the shader file still works, so I’m using that instead:

#include "../HeightmapSurface.cginc"

And in this situation it might actually be better. But I am left wondering why giving a filename that’s relative to the Assets folder is not an option for DX11. I’m guessing that it was never recommended, since Aras doesn’t mention it in his answer. But it might have also been left out, because it was already mentioned in a previous answer.

Is using file-paths relative to the Assets folder no longer supported, or is this just a bug?

Can you file a bug report so we don’t forget?

Done.
Ticket ID: 508456

You should remove the part from the underscore onwards: otherwise I think people can get into your bug history by putting that in the URL. The initial number is all Unity needs to reference the case.

Thanks, I was wondering if that were the case, but I assumed it was using the session that was already open for things like the forum, etc.

Luckily my bug history is rather boring :).

RC-1290:

I came here by googling the same shader warning about failing to open source file. Switching to relative path fixed the warning for me and finally allowed me to use a custom cginc file, so thanks for posting. :slight_smile: I will refrain from opening a bug report as you appear to have done so already.