3
\$\begingroup\$

What is the easiest and the most accurate way to combine tiles into a single platform in Unity, with no gaps, overlaps, or misalignment with the already-placed tiles, so that it looks like one continuous piece?

Here is what I mean:

enter image description here

I would like to be able to do the combination of platforms without the dragging by mouse.

I thought about doing it through the coordinates and a little bit of small calculations, but I was not able to find the width of the game object with the respect to coordinates in the Inspector.

\$\endgroup\$
  • \$\begingroup\$ @DMGregory, I updated the question. Yes, maybe my problem is possible to solve using some snapping mechanism, but I do not know how to do it in Unity and I am not sure that it is the best way to do it. Thanks for the attention anyway. ( : \$\endgroup\$ – trafalgarLaww Nov 5 '17 at 13:41
  • \$\begingroup\$ Can you clarify what you mean by "do the combination of platforms without the dragging by mouse?" I just spotted this on a re-read, and I was wondering if that means the built-in snapping I described below might be unsuitable. \$\endgroup\$ – DMGregory Nov 5 '17 at 14:19
  • \$\begingroup\$ Hmmm... I think I'm still not understanding your requirements then. Does the vertex snapping not eliminate gaps? \$\endgroup\$ – DMGregory Nov 5 '17 at 14:25
  • \$\begingroup\$ @DMGregory, forget it. Everything is nice and suitable. Thanks for the attention. \$\endgroup\$ – trafalgarLaww Nov 5 '17 at 14:35
  • \$\begingroup\$ why are you placing tiles individually? the tilemap system is supposed to be used with a tilemap inside a grid, with tiles being "brushed" on from the palette. This allows the engine to maintain only one tile instance per tile type, and the tilemap objects themselves are a single mesh with dynamically textured quads. Any deviation from the intended use is going to forfeit the performance gains by using a tiles system. \$\endgroup\$ – Stephan Nov 16 '17 at 18:24
6
\$\begingroup\$

Using the Move tool (not the RectTransform tool)

Move tool - icon with 4 crossing arrows
(Image from Unity docs)

Hold the V key to enable vertex snapping, and hover over the corners of your sprite. The transform gizmo will snap to the closest vertex.

Keep holding v, and click and drag that vertex to the corresponding vertex of the rest of your chain:

Animation showing vertex snapping

In my tests, this is most precise when zoomed in.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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