2D Toolkit Forum

2D Toolkit => Support => Topic started by: 1337Rooster on September 04, 2013, 04:57:52 am

Title: NullPointerException when using the tilemap editor?
Post by: 1337Rooster on September 04, 2013, 04:57:52 am
I followed the guide here for version 2.10.
http://www.unikronsoftware.com/2dtoolkit/docs/2.10/tilemap/tutorial.html

The only things I did different, was using my own sprite collection and using a pixels per meter of 1 for my camera and sprite collection.

I get two different errors in the console and the painter doesn't work.

NullReferenceException: Object reference not set to an instance of an object
tk2dTileMapEditorBrush.ClipTiles (Int32 xMin, Int32 yMin, Int32 xMax, Int32 yMax) (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditorData.cs:159)
tk2dTileMapSceneGUI.UpdateWorkingBrush () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:990)
tk2dTileMapSceneGUI.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:616)
tk2dTileMapEditor.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:1164)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/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 /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:1346)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:850)
UnityEditor.SceneView.OnGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:739)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)





and

NullReferenceException: Object reference not set to an instance of an object
tk2dTileMapSceneGUI.SplatWorkingBrush () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:319)
tk2dTileMapSceneGUI.RectangleDragEnd () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:351)
tk2dTileMapSceneGUI.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:636)
tk2dTileMapEditor.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:1164)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/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 /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:1346)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:850)
UnityEditor.SceneView.OnGUI () (at C:/BuildAgent/work/7535de4ca26c26ac/Editor/Mono/SceneView/SceneView.cs:739)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Title: Re: NullPointerException when using the tilemap editor?
Post by: 1337Rooster on September 04, 2013, 05:57:50 am
Seems like starting over from scratch solves the problem, and deleting the tilemap. But I would hate for this to happen again and lose a lot of work because of it. Hopefully the stack trace helps track down the bug.
Title: Re: NullPointerException when using the tilemap editor?
Post by: unikronsoftware on September 04, 2013, 01:06:45 pm
It looks like the brush is broken there - not sure how it could have happened. Were you modifying (adding and removing things) the sprite collection when this happened? I've not seen this one before.

There are ways to simply reset this without causing any issues or losing work - you can open up the tilemap data object and remove the saved brush data in there if this was caused by the brush.