x


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!

more ▼

asked Jul 18 '12 at 07:40 AM

CronoTrig gravatar image

CronoTrig
1 1 1 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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
more ▼

answered Jul 18 '12 at 09:43 AM

Paulius Liekis gravatar image

Paulius Liekis
7.3k 16 24 45

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1701
x1363
x1037
x233
x99

asked: Jul 18 '12 at 07:40 AM

Seen: 587 times

Last Updated: Jul 18 '12 at 09:44 AM