Shader Compile Error / Error Compiling Several Shaders

Avatar
  • updated
  • Fixed

Shader error in 'Shapes/Triangle Transparent': redefinition of 'InverseLerp' at Math.cginc(55) (on vulkan)

Compiling Vertex program

Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR

Disabled keywords: INSTANCING_ON UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30

Reporting a bug? please specify Unity version:
2021.1.3f1
Reporting a bug? please specify Shapes version:
3.2.3
Reporting a bug? please specify Render Pipeline:
URP
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Under Review

if you open Shapes Math.cginc and go to the line that says

#ifndef SHADER_API_METAL

try replacing it with this:

#if defined(SHADER_API_METAL) == false && defined(SHADER_API_VULKAN) == false

and let me know if it works!

Avatar
Justin Wasilenko

Clean reinstall completed twice, tried a couple of things, still same errors. :(

Edit: Tried a third time. Looks like it's related to moving the Shapes directory anywhere outside of the main Assets folder. I got it to compile and build if I left it in Assets, but when I moved it, that's when it would not build.

Avatar
Freya Holmér creator

that's, bizarre, could you try a clean reinstall?

Avatar
Justin Wasilenko

Using Unity 2021.2.9, Android build target, Vulkan, URP, Shapes 4.1.3; I get the following compile errors while trying to build:

Avatar
Freya Holmér creator
  • Fixed

cool! I've added this to 4.0.0 now

Avatar
Quote from Freya Holmér

if you open Shapes Math.cginc and go to the line that says

#ifndef SHADER_API_METAL

try replacing it with this:

#if defined(SHADER_API_METAL) == false && defined(SHADER_API_VULKAN) == false

and let me know if it works!

Worked for me! I've had this problem with a lot of projects, I would appreciate if this line was added to the asset.

Avatar
Freya Holmér creator
  • Answer
  • Under Review

if you open Shapes Math.cginc and go to the line that says

#ifndef SHADER_API_METAL

try replacing it with this:

#if defined(SHADER_API_METAL) == false && defined(SHADER_API_VULKAN) == false

and let me know if it works!