Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error unexpected end of file at line (on d3d11) #33

Open
jBachalo opened this issue Mar 8, 2021 · 1 comment
Open

Syntax error unexpected end of file at line (on d3d11) #33

jBachalo opened this issue Mar 8, 2021 · 1 comment

Comments

@jBachalo
Copy link

jBachalo commented Mar 8, 2021

Great resource!

One error I get after conversion is
syntax error: unexpected end of file at line...(d3d11)

However I can see nothing wrong at that specific line
pa=length(p);

I guess the problem lies elsewhere?
Perhaps the location of ENDCG or???

@smkplus
Copy link
Owner

smkplus commented Mar 9, 2021

this is a common error!

yes, sometimes it's related to the location of ENDCG like this:

            fixed4 frag (v2f i) : SV_Target
            {
                return 1;
            }
        }
        ENDCG

but usually, people forget to use the curly braces
try to uncomment line 49

Shader "Hidden/Test"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;

            fixed4 frag (v2f i) : SV_Target
            {
                return 1;
            }
            ENDCG
        }
    }
// Shader error in 'Test': Parse error: syntax error, unexpected $end at line 49
// Uncomment line 49 to fix this problem
// } 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants