Closed davidyrgilbert closed 2 years ago
Hi and thanks for the report!
Yes, the AssetDatabase.LoadAsset
calls in 1.10.1-pre should indeed prevent this. Could you try reverting to the version before (1.10.0-pre) that used GatherDependenciesFromSourceAsset
?
I'll add another in-editor workaround in the place where PBRGraph is using Shader.Load - my assumption was that AssetDatabase.LoadAsset followed by Shader.Load would always succeed but seems that's not the case (it worked in my tests though).
Thanks for the quick response!
I've had a "hack" in there before this version as well, from way back from the origial repo actually. The thing that at the moment works if I call AssetDatabase.LoadAsset
directly, and save the result in the shader variable.
Shader s = null;
#if UNITY_EDITOR
var path = "Packages/org.khronos.unitygltf/Runtime/Shaders/ShaderGraph/PBRGraph.shadergraph";
s = AssetDatabase.LoadAssetAtPath<Shader>(path);
if(s == null)
{
s = Shader.Find(shaderName);
}
#else
s = Shader.Find(shaderName);
#endif
That's pretty ugly but did the trick, but is obviously not applicable in general. I haven't yet tried it in a brand new project, maybe some settings or so are broken on my end? It almost feels like it's trying to import things before actually setting up the importer correctly the first time the project loads.
Thanks - that's exactly what I'll add, just with the more stable GUID instead of the path :)
Perfect, thanks a lot!
Should be fixed on latest dev - would be great if you try!
Should be fixed on latest dev - would be great if you try!
Tried it yesterday and didn't find any issues anymore, thanks a lot!
Hello, I'm getting an issue when loading a project that uses imported gltfs/glbs for the first time. The full error is as following:
I thought the recent commits that always ensured the shaders are loaded by the asset database fixes this, but unfortunately it did not. I'm using Unity 2021.3.5 with URP and the latest dev branch here.
Doing a reimport all (or just reimporting the broken meshes) fixes it, but every time someone clones a fresh project, the error pops up.