Generating Shaders - Change Suggestion for usage in local Unity package
Hello,
my context:
I'm using Shapes wrapped in a local custom Unity package being used by multiple projects.
These projects are using different RenderPipelines, so Shaders need to be regenerated dynamically depending on the current open project and the current RenderPipeline targeted.
Usually this would be no problem but using Shapes inside a custom package fails at generating the shaders at the right file path.
I found and implemented a fix for that inside the CodegenShaders.cs:
line: 78
shaderPathContents.ForEach( pc => File.WriteAllText(Path.GetFullPath(pc.path), pc.content ) ); // write all shaders
The method Path.GetFullPath() converts the given path to an absolute path which fixes shader generation.
Just wanted to suggest this for future release as I usually don't like editing 3rd party code at all.
Best regards