Closed hyblocker closed 4 months ago
Try to remove the leading /
.
Weird that it doesn't work though as I remember specifically adding support for that
https://github.com/d4rkc0d3r/d4rkAvatarOptimizer/blob/main/Editor/ShaderAnalyzer.cs#L382
I had to change it to this to get it to work:
if (currentFilePath.StartsWithSimple("/Assets/") || currentFilePath.StartsWithSimple("Assets/"))
{
var path = Path.GetDirectoryName(callerPath);
var assetFolderPath = path.IndexOf("Assets") != -1 ? path.Substring(0, path.IndexOf("Assets") - 1) : path;
if (currentFilePath[0] == '/') {
currentFilePath = currentFilePath.Substring(1);
}
currentFilePath = Path.Combine(assetFolderPath, currentFilePath);
}
I think it's because of the leading /
causing Path.Combine
to mess up the evaluated path.
The recursive shader include parser fails to correctly resolve the following types of paths:
These paths use a
/
to tell the shader compiler to start looking at the project root, so that no matter where I use the above lines from within a project, it will always find the absolute path.