Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a birds-eye-view for our Unity3D game world, where each point of interest has a label hovering above it. The problem is that sometimes they overlap, although there is more than enough space on the screen for them to co-exist.

Can anybody think of a better way to separate them than checking every texture with every other texture and moving them away from each other?

share|improve this question
up vote 3 down vote accepted

I managed to do it this way:

  • Put all gui elements in a list.
  • sort them from bottom to top on their Y coordinate
  • loop through them in this order, if one collides with a previous one, move it up as much as necessary and go to the next.

this way you'll get a neat stack of GUI-labels (names of game objects in my case) and they'll never overlap.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.