Error when trying to use WorldReflectionVector while manipulating normals

I’m following a shader tutorial and am hitting a confusing error. I’m planning to contact that tutorial author as well but in the meantime figured I should try looking it up first, and the closest I came was this old forum thread . Perhaps the error I’m getting is another bug? Specifically, here’s the code for my shader:

Shader "Holistic/BumpedEnv" {

    Properties {
        _myDiffuse ("Diffuse Texture", 2D) = "white" {}
        _myBump ("Bump Texture", 2D) = "bump" {}
        _myCube ("Cube Map", Cube) = "white" {}
    }
  
    SubShader {
        CGPROGRAM
        #pragma surface surf Lambert
      
        sampler2D _myDiffuse;
        sampler2D _myBump;
        samplerCUBE _myCube;
      
        struct Input {
            float2 uv_myDiffuse;
            float2 uv_myBump;
            float3 worldRefl;
        };
      
        void surf (Input IN, inout SurfaceOutput o) {
            o.Albedo = tex2D(_myDiffuse, IN.uv_myDiffuse).rgb;
            o.Normal = UnpackNormal(tex2D(_myBump, IN.uv_myBump));
            o.Emission = texCUBE(_myCube, IN.worldRefl).rgb;
        }
        ENDCG
    }
  
    FallBack "Diffuse"
}

When I comment out either the o.Normal line or o.Emission then it works, but when I try to do both at once there’s this error:

Am I just doing something wrong?

What the compiler says: add INTERNAL_DATA after your “float3 worldRefl;” declaration.

1 Like

Thanks. I posted this a little too soon because the tutorial goes on to say “this code caused an error though, so we need to blah” Warn the learner beforehand, bad writing!

I’m getting the same error even though INTERNAL_DATA is already in the input structure; and a nearly identical shader doesn’t have that error.