2D Toolkit Forum
2D Toolkit => Support => Topic started by: adangly on March 17, 2014, 03:35:30 am
-
I just got a random "aabb.IsValid()" when enter my game's level, and finally I found it's caused by tilemap's chunk;
It seemed that the mesh of chunk is wrong, because if I replace the mesh with another(in run time), the error gone. But the default mesh of chunk is always 0 verts, 0 tris, that makes me confused.
Can anyone tell me why, and how to solve it? :)
And my tk2d version is 2.2.3.
-
Is this all the meshes, or just the empty chunks? It can possibly leave empty chunk mesh present on occasion. It shouldn't cause any issues though. You can delete the render data object and Commit to have it reconstruct everything - that may help.
-
Thanks for reply.
The problem is only happened on chunk, not every mesh; and I think it's not a data problem, because the error not happened every time, just randomly.
And I try this:
change tk2dTileMapMeshBuilder.cs line 145
var meshFilter = chunk.gameObject.GetComponent<MeshFilter>();
meshFilter.sharedMesh = chunk.mesh;
to
if (Application.isPlaying == false)
{
var meshFilter = chunk.gameObject.GetComponent<MeshFilter>();
meshFilter.sharedMesh = chunk.mesh;
}
Then everything works fines, no "aabb.IsValid()" anymore.
I guess it may caused by mesh.RecalculateBounds(), maybe sometimes it sucked :-\