Not signed in
Copyright © 2026 Unity Technologies
It looks like the shader needs few fixes to work with no errors: * struct Varyings {...} needs a ";" at the end of it. * You're using: #pragma vertex MeshCloudVertex but then you have Varyings Vertex(Attributes IN) { Varyings OUT = (Varyings)0; OUT.color.w = ComputeFogFactor(OUT.positionHCS.z); } The compiler looks for a function named MeshCloudVertex (because of the #pragma vertex line). But you’ve actually defined Vertex. Because of this mismatch, Unity falls back to some default behavior during compilation and re-parses Varyings in a way that leads to a duplicate structure definition in the generated code for Metal. So the user should either change the pragma to "#pragma vertex Vertex" or rename their function to "Varyings MeshCloudVertex". * Also the function is missing a return value of type Varyings -> Add "return OUT;" at the end of the function.
It looks like the shader needs few fixes to work with no errors: * struct Varyings {...} needs a ";" at the end of it. * You're using: #pragma vertex MeshCloudVertex but then you have Varyings Vertex(Attributes IN) { Varyings OUT = (Varyings)0; OUT.color.w = ComputeFogFactor(OUT.positionHCS.z); } The compiler looks for a function named MeshCloudVertex (because of the #pragma vertex line). But you’ve actually defined Vertex. Because of this mismatch, Unity falls back to some default behavior during compilation and re-parses Varyings in a way that leads to a duplicate structure definition in the generated code for Metal. So the user should either change the pragma to "#pragma vertex Vertex" or rename their function to "Varyings MeshCloudVertex". * Also the function is missing a return value of type Varyings -> Add "return OUT;" at the end of the function.
Reproduction steps:
1. Open the attached “IN-96041_Repro.zip“ project
2. Select the “Assets/MyTestShader.shader“ Shader in the Project Browser
3. Observe the Console
Expected result: No errors are present
Actual result: “Shader error in 'MyTestShader': redefinition of 'Varyings' at Assets/MyTestShader.shader(43) (on metal)“ appears
Reproducible with: 2022.3.59f1, 6000.0.40f1
Couldn’t test with: 6000.1.0b8, 6000.2.0a5 (Instead a different error is present from [Internal link])
Reproducible on: M1 Max MacOS 15.1.1 (Tested by CQA)
Not reproducible on: No other environment tested
Sign in to see your voted issues