Open antonio-gomez opened 7 years ago
Same here.
Here's my stack trace:
NullReferenceException: Object reference not set to an instance of an object
System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:595)
Gltf.Serialization.Exporter.ExportTexture (UnityEngine.Texture2D unityTexture, System.String name) (at Assets/Gltf/Editor/Exporter.cs:584)
Gltf.Serialization.Exporter.ExportMaterialCore (UnityEngine.Material unityMaterial, Boolean packOcclusion, System.Int32& index) (at Assets/Gltf/Editor/Exporter.cs:399)
Gltf.Serialization.Exporter.ExportMaterial (UnityEngine.Material unityMaterial) (at Assets/Gltf/Editor/Exporter.cs:357)
Gltf.Serialization.Exporter.ExportNode (UnityEngine.GameObject gameObject) (at Assets/Gltf/Editor/Exporter.cs:317)
Gltf.Serialization.Exporter.<Export>m__2 (UnityEngine.GameObject inputObject) (at Assets/Gltf/Editor/Exporter.cs:149)
System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[UnityEngine.GameObject,System.Int32].MoveNext ()
System.Collections.Generic.List`1[System.Int32].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
System.Collections.Generic.List`1[System.Int32]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
System.Linq.Enumerable.ToArray[Int32] (IEnumerable`1 source)
Gltf.Serialization.Exporter.Export (IEnumerable`1 inputObjects, System.String outputDirectory, System.String outputName, Boolean outputBinary, ExportSettings settings) (at Assets/Gltf/Editor/Exporter.cs:149)
Gltf.Serialization.GameObjectExtensions.Export (IEnumerable`1 inputObjects, System.String outputDirectory, System.String outputName, Boolean outputBinary, ExportSettings settings) (at Assets/Gltf/Editor/Exporter.cs:59)
Gltf.Serialization.GameObjectExtensions.Export (UnityEngine.GameObject inputObject, System.String outputDirectory, System.String outputName, Boolean outputBinary, ExportSettings settings) (at Assets/Gltf/Editor/Exporter.cs:52)
Gltf.Serialization.ExportWindow+<OnGUI>c__AnonStorey0.<>m__0 (UnityEngine.GameObject gameObject) (at Assets/Gltf/Editor/ExportWindow.cs:91)
EnumerableExtensions.ForEach[GameObject] (IEnumerable`1 values, System.Action`1 action) (at Assets/Gltf/EnumerableExtensions.cs:10)
Gltf.Serialization.ExportWindow.OnGUI () (at Assets/Gltf/Editor/ExportWindow.cs:89)
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 /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:272)
UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:265)
UnityEditor.HostView.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:94)
I think this has to do with textures being compressed:
Unsupported texture format - Texture2D::EncodeTo functions do not support compressed texture formats.
UnityEngine.ImageConversion:EncodeToPNG(Texture2D)
Gltf.Serialization.Exporter:ExportTexture(Texture2D, String) (at Assets/Gltf/Editor/Exporter.cs:557)
Gltf.Serialization.Exporter:ExportMaterialCore(Material, Boolean, Int32&) (at Assets/Gltf/Editor/Exporter.cs:399)
Gltf.Serialization.Exporter:ExportMaterial(Material) (at Assets/Gltf/Editor/Exporter.cs:357)
Gltf.Serialization.Exporter:ExportNode(GameObject) (at Assets/Gltf/Editor/Exporter.cs:317)
Gltf.Serialization.Exporter:<Export>m__2(GameObject) (at Assets/Gltf/Editor/Exporter.cs:149)
System.Linq.Enumerable:ToArray(IEnumerable`1)
Gltf.Serialization.Exporter:Export(IEnumerable`1, String, String, Boolean, ExportSettings) (at Assets/Gltf/Editor/Exporter.cs:149)
Gltf.Serialization.GameObjectExtensions:Export(IEnumerable`1, String, String, Boolean, ExportSettings) (at Assets/Gltf/Editor/Exporter.cs:59)
Gltf.Serialization.GameObjectExtensions:Export(GameObject, String, String, Boolean, ExportSettings) (at Assets/Gltf/Editor/Exporter.cs:52)
Gltf.Serialization.<OnGUI>c__AnonStorey0:<>m__0(GameObject) (at Assets/Gltf/Editor/ExportWindow.cs:91)
EnumerableExtensions:ForEach(IEnumerable`1, Action`1) (at Assets/Gltf/EnumerableExtensions.cs:10)
Gltf.Serialization.ExportWindow:OnGUI() (at Assets/Gltf/Editor/ExportWindow.cs:89)
UnityEditor.HostView:OnGUI()
By disabling compression in the texture settings, I was able to export successfully.
I'm using Unity 2017.01.f03
Yes, this is a known issue with the exporter right now. You must manually disable the compression of the textures.
After the texture format error I'm getting the following NullReferenceException:
NullReferenceException: Object reference not set to an instance of an object System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:595) Gltf.Serialization.Exporter.ExportTexture (UnityEngine.Texture2D unityTexture, System.String imageName, Boolean normalMap) (at Assets/Gltf/Editor/Exporter.cs:487) Gltf.Serialization.Exporter.ExportMaterial (UnityEngine.Material unityMaterial) (at Assets/Gltf/Editor/Exporter.cs:330) Gltf.Serialization.Exporter.ExportNode (UnityEngine.GameObject gameObject) (at Assets/Gltf/Editor/Exporter.cs:259) Gltf.Serialization.Exporter+cAnonStoreyB.<>m1 (UnityEngine.GameObject child) (at Assets/Gltf/Editor/Exporter.cs:249)
System.Linq.Enumerable+cIterator10m 1A (UnityEngine.GameObject inputObject) (at Assets/Gltf/Editor/Exporter.cs:110)
System.Linq.Enumerable+cIterator10c AnonStorey0.<>m__0 (UnityEngine.GameObject gameObject) (at Assets/Gltf/Editor/ExportWindow.cs:86)
EnumerableExtensions.ForEach[GameObject] (IEnumerable
2[UnityEngine.GameObject,System.Int32].MoveNext () System.Collections.Generic.List
1[System.Int32].AddEnumerable (IEnumerable1 enumerable) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128) System.Collections.Generic.List
1[System.Int32]..ctor (IEnumerable1 collection) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65) System.Linq.Enumerable.ToArray[Int32] (IEnumerable
1 source) Gltf.Serialization.Exporter.ExportNode (UnityEngine.GameObject gameObject) (at Assets/Gltf/Editor/Exporter.cs:249) Gltf.Serialization.Exporter.2[UnityEngine.GameObject,System.Int32].MoveNext () System.Collections.Generic.List
1[System.Int32].AddEnumerable (IEnumerable1 enumerable) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128) System.Collections.Generic.List
1[System.Int32]..ctor (IEnumerable1 collection) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65) System.Linq.Enumerable.ToArray[Int32] (IEnumerable
1 source) Gltf.Serialization.Exporter.Export (IEnumerable1 inputObjects, System.String outputDirectory, System.String outputName, Boolean outputBinary, Formatting jsonFormatting, ImageFormat imageFormat, Extensions extensions) (at Assets/Gltf/Editor/Exporter.cs:110) Gltf.Serialization.GameObjectExtensions.Export (IEnumerable
1 inputObjects, System.String outputDirectory, System.String outputName, Boolean outputBinary, Formatting jsonFormatting, ImageFormat imageFormat, Extensions extensions) (at Assets/Gltf/Editor/Exporter.cs:35) Gltf.Serialization.GameObjectExtensions.Export (UnityEngine.GameObject inputObject, System.String outputDirectory, System.String outputName, Boolean outputBinary, Formatting jsonFormatting, ImageFormat imageFormat, Extensions extensions) (at Assets/Gltf/Editor/Exporter.cs:28) Gltf.Serialization.ExportWindow+1 values, System.Action
1 action) (at Assets/Gltf/EnumerableExtensions.cs:10) Gltf.Serialization.ExportWindow.OnGUI () (at Assets/Gltf/Editor/ExportWindow.cs:84) 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:249) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:242) UnityEditor.HostView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:76)