An asset is marked with HideFlags.DontSave but is included in the build

I’ve got a shader that I’m using for debug visualization using the GL system. It’s a pretty straightforward shader called Simple-Line.shader:

Shader "Hidden/Line"
{
    SubShader
    {
        Pass
        {
            Blend SrcAlpha OneMinusSrcAlpha
            ZWrite Off
            Cull Off
            Fog { Mode Off }

            BindChannels
            {
                Bind "vertex", vertex
                Bind "color", color
            }
        }
    }
}

My problem is, when creating builds, Unity is frequently spitting out the following error, which causes the build to fail:

Making a minor tweak to the shader file (like adding a newline and saving) seems to resolve the issue. But why is this a problem in the first place? I’m definitely NOT marking the shader as HideFlags.DontSave in my editor code anywhere. Is there a naming conflict between my asset and some internal Unity asset? Any ideas on how I could fix this once and for all?

i had the same issue with an image… one day the compiling process was successfull the next day it compained about some image An asset is marked with HideFlags.DontSave but is included in the build

In my case the solution was, like in your case, change something in the image import settings and re-apply… there seems to be some kind of cache issue…

1 Like