Open trashie65 opened 4 years ago
Hi. Would you be willing to share the sample scene so I can take a look at it? You could send it to neginfinity000 (at) gmail.com or post a link here.
Hey there, i was hoping you found a solution. I am running into the same trouble.
NullReferenceException: Object reference not set to an instance of an object
SceneExport.JsonAnimationEvent.writeRawJsonValue (SceneExport.FastJsonWriter writer) (at Assets/ExodusExport/Scripts/Editor/Exporter/JsonAnimationEvent.cs:15)
SceneExport.FastJsonWriter.writeRawValue[T] (T val) (at Assets/ExodusExport/Scripts/Editor/Exporter/FastJsonWriter/CoreGenerics.cs:11)
SceneExport.FastJsonWriter.writeValue[T] (T val) (at Assets/ExodusExport/Scripts/Editor/Exporter/FastJsonWriter/CoreGenerics.cs:16)
SceneExport.FastJsonWriter.writeRawValue[T] (System.Collections.Generic.List1[T] values, System.Int32 stride) (at Assets/ExodusExport/Scripts/Editor/Exporter/FastJsonWriter/CoreGenerics.cs:163) SceneExport.FastJsonWriter.writeKeyVal[T] (System.String key, System.Collections.Generic.List
1[T] val, System.Int32 stride) (at Assets/ExodusExport/Scripts/Editor/Exporter/FastJsonWriter/CoreGenerics.cs:76)
SceneExport.FastJsonWriter.writeKeyVal[T] (System.String key, System.Collections.Generic.List1[T] val) (at Assets/ExodusExport/Scripts/Editor/Exporter/FastJsonWriter/CoreGenerics.cs:59) SceneExport.JsonAnimationClip.writeRawJsonValue (SceneExport.FastJsonWriter writer) (at Assets/ExodusExport/Scripts/Editor/Exporter/JsonAnimationClip.cs:39) SceneExport.Utility.toJsonString[T] (T arg) (at Assets/ExodusExport/Scripts/Editor/Exporter/Utility.cs:246) SceneExport.Utility.saveToJsonFile[T] (T arg, System.String filename) (at Assets/ExodusExport/Scripts/Editor/Exporter/Utility.cs:251) SceneExport.ResourceMapper.saveResourceToPath[DstType,SrcType] (System.String baseDir, SrcType srcObj, System.Int32 objIndex, SceneExport.ResId objId, System.Int32 objCount, SceneExport.ResourceMapper+IndexedObjectConverter
2[SrcType,ReturnType] converter, System.Func2[T,TResult] nameFunc, System.String baseName, System.Boolean showGui, System.Action
1[T] dstProcessor) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:415)
SceneExport.ResourceMapper.saveResourcesToPath[DstType,SrcType,StorageType] (System.Collections.Generic.List1[T] outObjectPaths, System.String baseDir, SceneExport.ResourceStorageWatcher
2[Storage,Resource] objects, SceneExport.ResourceMapper+IndexedObjectConverter2[SrcType,ReturnType] converter, System.Func
2[T,TResult] nameFunc, System.String baseName, System.Boolean showGui, System.Action1[T] dstProcessor) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:435) SceneExport.ResourceMapper.saveResourceToFolder (System.String baseDir, System.Boolean showGui, System.Collections.Generic.List
1[T] scenes, SceneExport.Logger logger, System.Boolean collectExternAssets) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:689)
SceneExport.JsonProject.saveToFile (System.String filename, System.Boolean showGui, System.Boolean saveResourceFiles, SceneExport.Logger logger) (at Assets/ExodusExport/Scripts/Editor/Exporter/EditorOnly/JsonProject.cs:183)
SceneExport.ExporterWindow.beginCurrentSceneExport () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:273)
SceneExport.ExporterWindow.processExport () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:297)
SceneExport.ExporterWindow.processExportButtons () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:184)
SceneExport.ExporterWindow.OnGUI () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:214)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at
Hi, @JanusVV
Thanks for the report.
Hi @NegInfinity.
Thanks for responding!
I am using Unity 2019.3.14f1
hi I am running into the same trouble~~unity 2018.4.3f
Same problem here, is there a solution yet? I'm Unity2019.4.11, Win10. The asset i'm trying to export is Dark City 2.0 (https://assetstore.unity.com/packages/3d/environments/sci-fi/dark-city2-cyberpunk-pack-133817) the test scene came with it.
NullReferenceException: Object reference not set to an instance of an object
SceneExport.JsonMesh..ctor (SceneExport.MeshStorageKey meshKey, SceneExport.ResId id_, SceneExport.ResourceMapper resMap) (at Assets/ExodusExport/Scripts/Editor/Exporter/JsonMesh.cs:388)
SceneExport.ResourceMapper.makeJsonMesh (SceneExport.MeshStorageKey meshKey, SceneExport.ResId id) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:560)
SceneExport.ResourceMapper+<>c__DisplayClass59_0.2[SrcType,ReturnType] converter, System.Func
2[T,TResult] nameFunc, System.String baseName, System.Boolean showGui, System.Action1[T] dstProcessor) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:403) SceneExport.ResourceMapper.saveResourcesToPath[DstType,SrcType,StorageType] (System.Collections.Generic.List
1[T] outObjectPaths, System.String baseDir, SceneExport.ResourceStorageWatcher2[Storage,Resource] objects, SceneExport.ResourceMapper+IndexedObjectConverter
2[SrcType,ReturnType] converter, System.Func2[T,TResult] nameFunc, System.String baseName, System.Boolean showGui, System.Action
1[T] dstProcessor) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:435)
SceneExport.ResourceMapper.saveResourceToFolder (System.String baseDir, System.Boolean showGui, System.Collections.Generic.List`1[T] scenes, SceneExport.Logger logger, System.Boolean collectExternAssets) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:647)
SceneExport.JsonProject.saveToFile (System.String filename, System.Boolean showGui, System.Boolean saveResourceFiles, SceneExport.Logger logger) (at Assets/ExodusExport/Scripts/Editor/Exporter/EditorOnly/JsonProject.cs:183)
SceneExport.ExporterWindow.beginCurrentSceneExport () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:273)
SceneExport.ExporterWindow.processExport () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:297)
SceneExport.ExporterWindow.processExportButtons () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:184)
SceneExport.ExporterWindow.OnGUI () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:214)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at
Hi I just debugged a little bit and I think I found a solution. If your error trace also starts at ExodusExport/Scripts/Editor/Exporter/JsonMesh.cs:388, (check my comment above to see the complete error log of mine) this may help you. To check your error log, you need to open Console window, select Window on menu, ->General -> Console or simply do CTL+SHIFT+C inside Unity I'm using Unity 2018.3.0f2
I think the reason of the error here is at Assets/ExodusExport/Scripts/Editor/Exporter/JsonMesh.cs:388, inside public JsonMesh(MeshStorageKey meshKey, ResId id_, ResourceMapper resMap)
I put some console logs here, and found that at line 388, var mesh = meshKey.mesh;
is actually null value, so when you try to access name = mesh.name;
at the next line, it throws NullReferenceException.
The solution is actually simple, just add this one-line code if (mesh == null) return;
after line 388 var mesh = meshKey.mesh;
see photo:
By just adding these lines, I can finally export from Unity successfully. @NegInfinity maybe you can add this simple fix to your project so that other people won't have this issue any more? Let me know if this is a correct fix. Meanwhile, thank you for your great work, this is super useful tool for me!
Hi tried to export a scene.. no json file gets created and i get this error in Unity
NullReferenceException: Object reference not set to an instance of an object SceneExport.JsonMesh..ctor (SceneExport.MeshStorageKey meshKey, SceneExport.ResId id_, SceneExport.ResourceMapper resMap) (at Assets/ExodusExport/Scripts/Editor/Exporter/JsonMesh.cs:388) SceneExport.ResourceMapper.makeJsonMesh (SceneExport.MeshStorageKey meshKey, SceneExport.ResId id) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:560) SceneExport.ResourceMapper+<>c__DisplayClass59_0.b__5 (SceneExport.MeshStorageKey meshKey, System.Int32 idx, SceneExport.ResId id) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:648)
SceneExport.ResourceMapper.saveResourceToPath[DstType,SrcType] (System.String baseDir, SrcType srcObj, System.Int32 objIndex, SceneExport.ResId objId, System.Int32 objCount, SceneExport.ResourceMapper+IndexedObjectConverter:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:129)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401)
UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511)
UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307)
UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176)
UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245)
UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at
2[SrcType,ReturnType] converter, System.Func
2[T,TResult] nameFunc, System.String baseName, System.Boolean showGui, System.Action1[T] dstProcessor) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:403) SceneExport.ResourceMapper.saveResourcesToPath[DstType,SrcType,StorageType] (System.Collections.Generic.List
1[T] outObjectPaths, System.String baseDir, SceneExport.ResourceStorageWatcher2[Storage,Resource] objects, SceneExport.ResourceMapper+IndexedObjectConverter
2[SrcType,ReturnType] converter, System.Func2[T,TResult] nameFunc, System.String baseName, System.Boolean showGui, System.Action
1[T] dstProcessor) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:435) SceneExport.ResourceMapper.saveResourceToFolder (System.String baseDir, System.Boolean showGui, System.Collections.Generic.List`1[T] scenes, SceneExport.Logger logger, System.Boolean collectExternAssets) (at Assets/ExodusExport/Scripts/Editor/Exporter/ResourceMapper.cs:647) SceneExport.JsonProject.saveToFile (System.String filename, System.Boolean showGui, System.Boolean saveResourceFiles, SceneExport.Logger logger) (at Assets/ExodusExport/Scripts/Editor/Exporter/EditorOnly/JsonProject.cs:183) SceneExport.ExporterWindow.beginCurrentSceneExport () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:273) SceneExport.ExporterWindow.processExport () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:297) SceneExport.ExporterWindow.processExportButtons () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:184) SceneExport.ExporterWindow.OnGUI () (at Assets/ExodusExport/Scripts/Editor/GUI/ExporterWindow.cs:214) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (atAny Ideas please Thanks Tony