Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Default Shaders not working

Discussion in 'Editor & General Support' started by CaseJnr, Aug 14, 2014.

  1. CaseJnr

    CaseJnr

    Joined:
    May 14, 2014
    Posts:
    43
    Hi I am getting the following error when I create a new shader.

    Shader error in '': Parse error: syntax error at line 1

    To be clear, all I am doing is right clicking in the project panel and selection Create > Shader and the error appears. I am not modifying the shader at all. I am not even opening it.

    I have even tried changing the line endings and file format with no luck.

    Anybody have any ideas what is going on?

    I am using OSX Unity 4.5.0f6. Here is an example of the default shader

    Code (CSharp):
    1. Shader "Custom/NewShader" {
    2.     Properties {
    3.         _MainTex ("Base (RGB)", 2D) = "white" {}
    4.     }
    5.     SubShader {
    6.         Tags { "RenderType"="Opaque" }
    7.         LOD 200
    8.        
    9.         CGPROGRAM
    10.         #pragma surface surf Lambert
    11.  
    12.         sampler2D _MainTex;
    13.  
    14.         struct Input {
    15.             float2 uv_MainTex;
    16.         };
    17.  
    18.         void surf (Input IN, inout SurfaceOutput o) {
    19.             half4 c = tex2D (_MainTex, IN.uv_MainTex);
    20.             o.Albedo = c.rgb;
    21.             o.Alpha = c.a;
    22.         }
    23.         ENDCG
    24.     }
    25.     FallBack "Diffuse"
    26. }