[Solved] Very simple Vertex & Fragment shader won't work

I’ve done some graphics programming in my own game engines outside of unity, so I understand some of the more complicated subjects on the matter of shader code and techniques. That said, I can’t get a simple stupid vertex and fragment shader to work in unity, even when stripped down to the bare bones of rendering a solid color. I cannot use surface shaders for the effect I need to achieve.

First off, here’s the warning I get (10 times in a row every time I try to compile). A google search of the warning yields nothing helpful:

When I try to view the compiled shader, I get this error (again, google doesn’t help here):

Here is the simple shader code I’m trying to run:

Shader "Custom/SimpleVertFrag"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
        
            #include "UnityCG.cginc"
    
            float4 vert(float4 vIN:POSITION) : SV_POSITION
            {
                return vIN;
            }
        
            float4 frag(float4 fIN) : SV_TARGET
            {
                return float4(1, 1, 1, 1);
            }
        
            ENDCG
        }
    }
}

Any help is greatly appreciated!
EDIT: No need to point out my lack of positioning, I just need this to compile then I can handle everything else.

ok, i tried your shader on very latest (5.2) and here what i got:

Shader error in ‘Custom/SimpleVertFrag’: ‘frag’: input parameter ‘fIN’ missing semantics at line 18 (on d3d9)
oh well - your fIN misses semantic - bad
Shader error in ‘Custom/SimpleVertFrag’: syntax error, unexpected ‘=’ at line 26 (on metal)
that one is funny - SV_TARGET is wrong semantic name, it is SV_Target. If you change it this way all works

We’ll fix the SV_TARGET support. For now, use SV_Target like all the other Unity shaders do.

Interesting… I’ve got it working now. Thanks for the help guys :smile:

I forgot to put in a semantic in the frag shader input when I switched from a struct to just the float4. Had no idea about the SV_TARGET thing.