- Home /
Question by
Aggrojag · Mar 06, 2018 at 07:44 PM ·
shader programmingshaderlabshader writing
Header files in ShaderLab
How can I create header files in shaderlab? I want to be able to put my functions in an order that helps the readability of the shader.
Comment
Best Answer
Answer by Bunny83 · Mar 07, 2018 at 03:24 AM
If by "header" you mean an include file, just create a simple text file and include it in your shader with the #include
statement. Unity actually has several include files which are usually located atC:\Program Files\Unity\Editor\Data\CGIncludes
Usually relative path names should work just fine. So if you have an include file right next to your shader you should be able to include it with just the file name.
#include "MyInclude.inc"
Note that even most people seem to use "header" as a synonym for "include file", a header file is actually a special kind of include file.