[Editor Import] Projects without Library folder will fail to import previously imported glTFs
See original GitHub issueDescribe the bug Opening a pre-existing project, which doesn’t have it’s Library folder already present, will fail to import previously imported glTFs. This use case occurs due to CI pipelines on GitHub starting with the fresh clone of a project, with no library file, though is reproducible by manually wiping your Library folder. Error seems to be coming from a NRE, GltfImporter.cs:123 when attempting to add a material:
for (var i = 0; i < m_Gltf.materialCount; i++) {
var mat = m_Gltf.GetMaterial(i);
AddObjectToAsset(ctx, $"materials/{mat.name}", mat);
}
Files
Attach or link to .gltf/.glb files that trigger the bug. Should work with any gltf/glb, but here: rounded_cube_test.zip
To Reproduce Steps to reproduce the behavior:
- Add any glTF to a Unity Project through the editor
- It will import successfully
- Close the project
- Delete Library folder
- Re-open the project
- Note errors in console (see screenshot) and glTF has not imported.
Expected behavior The glTF imports sucessfully.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- glTFast version: Tested on 4.0.0, 4.5.0
- Unity Editor version: 2020.3.14f1, 2020.3.26f1
- Render Pipeline: Universal Render Pipeline 10.5.1 (on .14f1)
- Platform: Windows, Linux CI
Additional context Originally filed at: https://github.com/atteneder/DracoUnity/issues/39
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Ah right, famous AssetDB order inconsistencies 😃
Fwiw, we started replacing almost all asset loading that has to happen with calls to
AssetDatabase.LoadAssetAtPath<T>(AssetDatabase.GUIDToAssetPath("84743587345873458947539"))
with GUID-based references since it seems everything involving “find”/“searcher” services (Shader.Find
,AssetDatabase.Find
) are not deterministically available.Thanks for this fix!