GLTFUtility icon indicating copy to clipboard operation
GLTFUtility copied to clipboard

Getting "imageData[7] is null" on latest commit, unsuccessful model import

Open Casuallynoted opened this issue 5 years ago • 5 comments

I am getting this error while importing a gltf file:

Asset import failed, "Assets/La Noscea/_0x29d90007.gltf" > NullReferenceException: Object reference not set to an instance of an object
Siccity.GLTFUtility.GLTFMaterial.TryGetTexture (Siccity.GLTFUtility.GLTFTexture+ImportResult[] textures, Siccity.GLTFUtility.GLTFMaterial+TextureInfo texture, UnityEngine.Texture2D& tex) (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Spec/GLTFMaterial.cs:80)
Siccity.GLTFUtility.GLTFMaterial.CreateMaterial (Siccity.GLTFUtility.GLTFTexture+ImportResult[] textures, Siccity.GLTFUtility.ShaderSettings shaderSettings) (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Spec/GLTFMaterial.cs:50)
Siccity.GLTFUtility.GLTFMaterial+ImportTask.OnMainThreadFinalize () (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Spec/GLTFMaterial.cs:224)
Siccity.GLTFUtility.Importer+ImportTask`1[TReturn].RunSynchronously () (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Importer.cs:96)
Siccity.GLTFUtility.Importer.LoadInternal (Siccity.GLTFUtility.GLTFObject gltfObject, System.String filepath, Siccity.GLTFUtility.ImportSettings importSettings, Siccity.GLTFUtility.GLTFAnimation+ImportResult[]& animations) (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Importer.cs:138)
Siccity.GLTFUtility.Importer.ImportGLTF (System.String filepath, Siccity.GLTFUtility.ImportSettings importSettings, Siccity.GLTFUtility.GLTFAnimation+ImportResult[]& animations) (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Importer.cs:77)
Siccity.GLTFUtility.Importer.LoadFromFile (System.String filepath, Siccity.GLTFUtility.ImportSettings importSettings, Siccity.GLTFUtility.GLTFAnimation+ImportResult[]& animations, Siccity.GLTFUtility.Format format) (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Importer.cs:28)
Siccity.GLTFUtility.GLTFImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.siccity.gltfutility@32b2b5281fff71808d1ea928c78f33ca67944ffa/Scripts/Editor/GLTFImporter.cs:14)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)

Notably, the release unitypackage works as expected. Hoping to get some of the features that have been added since however if possible.

Casuallynoted avatar Jan 22 '20 23:01 Casuallynoted

Just realized this happens when a texture it's looking for is missing. Likewise, I seem to be getting this issue with some models:

JsonSerializationException: Required property 'primitives' expects a value but got null. Path 'meshes[141]', line 1, position 50833570.

Is there any way there could be a way for it to have a contingency for such cases?

Casuallynoted avatar Jan 23 '20 01:01 Casuallynoted

@Casuallynoted Could you include the model (or example model like it) you're trying to import to help reproduce the issue, thanks!

tfmertz avatar Jan 24 '20 01:01 tfmertz

@Casuallynoted Could you include the model (or example model like it) you're trying to import to help reproduce the issue, thanks!

Absolutely, the issue is easily replicated by taking a GLTF that uses external textures and removing one texture from the destination before import.

As for the second issue, that seems to have been an issue with the GLTF exporter I was using. However, I’ve run into a different issue for one file. It’s a 200MB GLTF, I’m using the Draco branch. It’s been importing for about 10 hours so far with no sign of an end. I’ll quick upload it here with textures so it can be looked at. Will post the link in just a few minutes here.

Casuallynoted avatar Jan 24 '20 23:01 Casuallynoted

https://drive.google.com/open?id=1m3dQS_yw_ViKrl6-IIscXNcPOPikWrZM

This is a link to the folder with the GLTF file in question inside. My unity version is 2018.4.14f1, which is the newest I can use for this particular project.

Casuallynoted avatar Jan 24 '20 23:01 Casuallynoted

https://drive.google.com/open?id=1m3dQS_yw_ViKrl6-IIscXNcPOPikWrZM

This is a link to the folder with the GLTF file in question inside. My unity version is 2018.4.14f1, which is the newest I can use for this particular project.

Interesting addition to this, I've tried importing the file using GLTFUtility from within the latest stable 2019 (2019.2) as well as the 2020 alpha, and both versions of Unity import it successfully. This seems to be an issue with GLTFUtility on 2018.

Casuallynoted avatar Jan 26 '20 00:01 Casuallynoted