- Home /
Tile-based approach in Unity
Hey there,
I was wondering what the best approach to creating a 2D (orthographic) tile-based world (dynamically generated) in Unity. Right now I am instantiating a (x by x) chunk of cubes (I have also tried 2 tri planes) when the player moves in a direction, such that the player is always moving into a chunk of cubes. Whichever direction the player is moved, new cubes will be created. The game starts to lag (FPS drop), however, when new cubes are generated. Each cube has a box collider attached to it. Does Unity check all possible collisions or something?
I am using a character controller for the player, and static box colliders for the tiles (cubes).
Am I going about this the wrong way? I read about creating one large mesh and using that as a collider, but how would that work with a tile-based world where there could be empty space between tiles and such.
Any help or pointers would be appreciated, thanks!
Answer by Paulius-Liekis · Jul 18, 2012 at 09:43 AM
Of course having too many colliders will cause problems. Usual solutions:
unloading some objets which are not necessary
grouping objects into bigger block and then loading/unloading these bigger pieces
Your answer
Follow this Question
Related Questions
Turn an objects mesh renderer on upon collision. 1 Answer
3d collider mesh to 2d collider mesh 0 Answers
How to make 3D colliders on sprites? 0 Answers
Dynamic mesh collider 4 Answers