Hello Guest

Author Topic: Error using TileMap: NullReferenceException  (Read 2628 times)

Balzaque

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Error using TileMap: NullReferenceException
« on: May 26, 2015, 08:02:13 pm »
Hi, I'm having problems trying to use the TileMap feature.

I have configured here a tk2dCamera with 12 pixels per unity, the sprite collection with a sprite sheet also configured with 12 pixels per unity, 2D Physics and Point with 0 padding.

Then I add on the scene a TileMap, select the sprite collection I just created and create the tileMapData and tileMapDataEditor, if I just commit the TileMap without any additional changes no exception happens but if I try to paint any tile or call SetTile and Build the TileMap from code the following exception happens.

I'm using Unity 5.0.2f free.

Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
tk2dRuntime.TileMap.RenderMeshBuilder.BuildForChunk (.tk2dTileMap tileMap, tk2dRuntime.TileMap.SpriteChunk chunk, tk2dRuntime.TileMap.ColorChunk colorChunk, Boolean useColor, Boolean skipPrefabs, Int32 baseX, Int32 baseY) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapMeshBuilder.cs:61)
tk2dRuntime.TileMap.RenderMeshBuilder.Build (.tk2dTileMap tileMap, Boolean editMode, Boolean forceBuild) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapMeshBuilder.cs:228)
tk2dTileMap.Build (BuildFlags buildFlags) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:309)
tk2dTileMapEditor.Build (Boolean force, Boolean incremental) (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:175)
tk2dTileMapEditor.BuildIncremental () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:180)
tk2dTileMapSceneGUI.RectangleDragEnd () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:392)
tk2dTileMapSceneGUI.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapSceneGUI.cs:661)
tk2dTileMapEditor.OnSceneGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:1236)
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-runtime-and-classlibs/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-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1975)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1341)
UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1179)
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-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

No idea what is going wrong and so far it seems like a really basic test, am I doing something wrong?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Error using TileMap: NullReferenceException
« Reply #1 on: May 27, 2015, 01:35:00 am »
It *is* really simple and this should work. If it doesn't, zip up your project and post it in the private support forum and I'll investigate.

Balzaque

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Error using TileMap: NullReferenceException
« Reply #2 on: May 27, 2015, 05:03:05 am »
Ok, will do, just waiting for my account to get validated so I can post there, thanks.