sketchfab / unity-plugin

291 stars 39 forks source link

Importing issue #2

Open Apidcloud opened 5 years ago

Apidcloud commented 5 years ago

Hello! Not sure if this is the best place to describe this issue, but I tried to import the Earthquakes model (https://sketchfab.com/3d-models/earthquakes-2000-to-2019-894ad84ceb8b444a91fbc05f20530bcd) in Unity but got 2 exceptions when doing so. Other models work, though.

Im using unity Unity 2018.2.8f1 (64-bit) and the latest sketchfab unity plugin.

The exceptions are as follows:

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[System.Collections.Generic.List`1[System.Collections.Generic.KeyValuePair`2[UnityEngine.Mesh,UnityEngine.Material]]].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
AssetManager.getMesh (Int32 nodeIndex, Int32 primitiveIndex)
UnityGLTF.GLTFEditorImporter.CreateNode (GLTF.Schema.Node node, Int32 index)
UnityGLTF.GLTFEditorImporter.CreateNode (GLTF.Schema.Node node, Int32 index)
UnityGLTF.GLTFEditorImporter.CreateNode (GLTF.Schema.Node node, Int32 index)
UnityGLTF.GLTFEditorImporter.CreateNode (GLTF.Schema.Node node, Int32 index)
UnityGLTF.GLTFEditorImporter+<LoadScene>d__57.MoveNext ()
TaskManager.play ()
UnityGLTF.GLTFEditorImporter.Update ()
Sketchfab.SketchfabImporter.Update () (at Assets/Sketchfab For Unity/Scripts/SketchfabImporter.cs:38)
Sketchfab.SketchfabBrowserManager.Update () (at Assets/Sketchfab For Unity/Scripts/AssetBrowser/SketchfabBrowserManager.cs:152)
Sketchfab.SketchfabBrowser.Update () (at Assets/Sketchfab For Unity/Scripts/AssetBrowser/SketchfabBrowserWindow.cs:96)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.SendUpdate () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:367)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:191)

And

IndexOutOfRangeException: Array index is out of range.
GLTF.Schema.MeshPrimitive.GenerateTriangles (Int32 vertCount)
UnityGLTF.GLTFEditorImporter.CreateMeshPrimitive (GLTF.Schema.MeshPrimitive primitive, System.String meshName, Int32 meshID, Int32 primitiveIndex)
UnityGLTF.GLTFEditorImporter.CreateMeshObject (GLTF.Schema.Mesh mesh, Int32 meshId)
UnityGLTF.GLTFEditorImporter+<LoadMeshes>d__53.MoveNext ()
TaskManager.play ()
UnityGLTF.GLTFEditorImporter.Update ()
Sketchfab.SketchfabImporter.Update () (at Assets/Sketchfab For Unity/Scripts/SketchfabImporter.cs:38)
Sketchfab.SketchfabBrowserManager.Update () (at Assets/Sketchfab For Unity/Scripts/AssetBrowser/SketchfabBrowserManager.cs:152)
Sketchfab.SketchfabBrowser.Update () (at Assets/Sketchfab For Unity/Scripts/AssetBrowser/SketchfabBrowserWindow.cs:96)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.SendUpdate () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:367)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:191)

Any ideas? Thanks!

alter-sachin commented 4 years ago

Were you able to resolve this ?

AurL commented 4 years ago

Hi @Apidcloud @alter-sachin ,

Sorry for the late feedback, the issue happens when you try to import a point cloud model (no triangles) into Unity. These models are currently not supported by the plugin and the error is not handled correctly at the moment. I don't even know if such data can be rendered in Unity without using a custom shader to render point clouds, or using a custom script to convert points into triangles to make them renderable using Standard shaders

I opened a ticket to improve this. In the meantime, you can have a look at the triangle count in model properties to detect such models (Face count: 0)