#`IPreprocessShaders` invalid subshader index with `PackageRequirements` use

1 messages · Page 1 of 1 (latest)

empty rose
#

When using a PackageRequirements block in a shader's subshader, when I try to load the following subshader in IPreprocessShaders.OnProcessShader I am getting errors that the index is invalid

#

it seems like unity gets out of sync when using PackageRequirements blocks in shaders, and loading the serialised shader in a shader preprocessor

#

there are two subshaders in this shader, the first is using PackageRequirements of HDRP which I don't have, and the second is using PackageRequirements of URP which I do, it looks like the first subshader is removed from the shader data or serialised subshader making the original index invalid