atteneder / DracoUnity

Draco 3D Data Compression Unity Package
Apache License 2.0
247 stars 39 forks source link

Draco compressed glTF import fails on headless pipeline #39

Closed mikeskydev closed 2 years ago

mikeskydev commented 2 years ago

Hi, I'm using glTFast and DracoUnity in a GitHub Actions pipeline, with draco compressed GLBs. The files are imported into the project instead of at runtime. This runs Unity on a headless Ubuntu instance. It fails to import the files, and as such the our app doesn't display the geometry for these models.

Building from Unity manually works fine on macOS and Windows.

Unity: 2020.3.14f1 glTFast: 4.4.10 DracoUnity: 3.3.2

Relevant error log:

2022-01-20T09:26:06.1421114Z Start importing Assets/Products/SampleModel.glb using Guid(8857eb8bb32258f4abd2736284ed2ef2) Importer(-1,00000000000000000000000000000000) Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:06.1421980Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0237254Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0239946Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0553130Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0553811Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0582498Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0583150Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0589177Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0589918Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0624786Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0625659Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0897638Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0898304Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0952072Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.0954980Z Fallback handler could not load library /opt/unity/Editor/Data/Mono/lib/libPackages/com.atteneder.draco/Runtime/Plugins/x86_64/libdracodec_unity.so
2022-01-20T09:26:07.1074568Z NullReferenceException: Object reference not set to an instance of an object
2022-01-20T09:26:07.1075343Z   at GLTFast.Editor.GltfImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) [0x001c4] in /github/workspace/AR Tool/Library/PackageCache/com.atteneder.gltfast@4.4.10/Editor/Scripts/GltfImporter.cs:123 
2022-01-20T09:26:07.1076403Z   at UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) [0x00001] in /home/bokken/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:22 
2022-01-20T09:26:07.1076995Z 
2022-01-20T09:26:07.1077367Z (Filename: Library/PackageCache/com.atteneder.gltfast@4.4.10/Editor/Scripts/GltfImporter.cs Line: 123)
2022-01-20T09:26:07.1077652Z 
2022-01-20T09:26:07.1085813Z Asset import failed, "Assets/Products/SampleModel.glb" > NullReferenceException: Object reference not set to an instance of an object
2022-01-20T09:26:07.1086596Z GLTFast.Editor.GltfImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.atteneder.gltfast@4.4.10/Editor/Scripts/GltfImporter.cs:123)
2022-01-20T09:26:07.1087598Z UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at /home/bokken/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:22)
2022-01-20T09:26:07.1088157Z 
2022-01-20T09:26:07.1106684Z  -> (artifact id: 'f2e51d33102ef21f38a5a10f58986777') in 1.123872 seconds 
atteneder commented 2 years ago

How did you install glTFast in that project? If it's via GIT, then make sure GIT LFS is enabled and pulled.

mikeskydev commented 2 years ago

Through the package manager with OpenUPM and Git LFS is enabled.

For a bit more information, we have another project that uses the same pipeline conditions, except the models are loaded at runtime from a CDN, and it appears to work fine.

atteneder commented 2 years ago

I'd check if libdracodec_unity.so is at the path specified (with correct size/content) and that there are no permission issues with it.

Let me know if that's the case. Otherwise I have no idea, but I maybe can forward the issue to some CI pro.

atteneder commented 2 years ago

The actual error might be this one though:

2022-01-20T09:26:07.1074568Z NullReferenceException: Object reference not set to an instance of an object
2022-01-20T09:26:07.1075343Z   at GLTFast.Editor.GltfImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) [0x001c4] in /github/workspace/AR Tool/Library/PackageCache/com.atteneder.gltfast@4.4.10/Editor/Scripts/GltfImporter.cs:123 
2022-01-20T09:26:07.1076403Z   at UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) [0x00001] in /home/bokken/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:22 

Have you tried importing the same file in the Editor (not at runtime)? Can you provide said file?

edit: Probably just missing a null check at that line

mikeskydev commented 2 years ago

I'd check if libdracodec_unity.so is at the path specified (with correct size/content) and that there are no permission issues with it.

I can check this once i've set up a ubuntu VM to test the runner, it might take a bit longer though!

Have you tried importing the same file in the Editor (not at runtime)? Can you provide said file?

Yes it works fine with an editor import. I can't provide the files but I can probably make an equivalent sample, we have 5 models and they're all having the same import issue.

mikeskydev commented 2 years ago

After looking at this further it appears to be an issue with glTFast import, as we encountered it on a non-draco asset. Will file a bug in that repository instead. Thanks!