Unexpected symbol error in shader script
I've been following a YouTube video on creating an outline shader and ended up with a script that, to me, looks line for line identical to the one in the video (before you ask, no, source code was not provided, hence writing it by myself).
After saving it, I keep getting the error:
"Shader error in 'Burja/ShaderTest': syntax error: unexpected token '}' at line 55 (on d3d11)" Adding a semicolon results in error:
"Shader error in 'Burja/ShaderTest': syntax error: unexpected end of file at line 56 (on d3d11)"
while deleting the bracket produces error:
"Shader error in 'Burja/ShaderTest': syntax error: unexpected end of file at line 55 (on d3d11)"
Any ideas? I really need help with this...
I should probably state that I'm a 3D artist and this is the first code I've writen in my life. I've seen a couple of videos on coding before and this video makes it really easy to understand what's going on while following and writing, but I don't yet have any idea how to solve errors on my own.
Oh, and I'm using Unity 2017.3.0 with Visual Studio 2017
Shader "Burja/ShaderTest"
{
Properties
{
_Color ("Main Color", Color) = (0.5,0.5,0.5,1)
_MainTex ("Texture", 2D) = "white" {}
_OutlineColor("Outline Color", Color) = (0,0,0,1)
_OutlineWidth("Outline Width", Range(1.0,5.0)) = 1.01
}
CGINCLUDE
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f
{
float4 pos : POSITION;
float3 normal : NORMAL;
};
float _OutlineWidth;
float4 _OutlineColor;
v2f vert(appdata v)
{
v.vertex.xyz *= _OutlineWidth;
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
return o;
}
ENDCG
SubShader
{
Tags{ "Queue" = "Transparent"}
Pass // Render The Outline
{
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 frag(v2f i) : COLOR
{
return _OutlineColor
}
ENDCG
}
Pass // Normal Render
{
ZWrite On
Material
{
Diffuse[_Color]
Ambient[_Color]
}
Lighting On
SetTexture[_MainTex]
{
ConstantColor[_Color]
}
SetTexture[_MainTex]
{
Combine previous * primary DOUBLE
}
}
}
}
Your answer
Follow this Question
Related Questions
Script errors 1 Answer
How to Destroy game object horizontally and vertically , when hit by a Raycast 0 Answers
"The associated script cannot be loaded." 0 Answers
C# - Cannnot access variable in another script unless I get the component everytime. 1 Answer
Error CS0120 : An object reference is required to access non-static member 3 Answers