0
\$\begingroup\$

I'm setting up a 2D arena game, and I'm trying to implement an ability for tilemaps to be highlighted (on hover). I've already managed to get a Vector3 of the hovered tile using rays and WorldToCell, but I don't know how to actually "highlight" the tilemap by creating a border around it. Is this possible or am I going to need some other sprite that has a highlighted version of the tile? Here's my layout now:

enter image description here

I need it to look something like this: enter image description here

\$\endgroup\$
  • \$\begingroup\$ Can you draw an example of what you want this border highlight to look like? \$\endgroup\$ – DMGregory Aug 5 '18 at 11:52
  • \$\begingroup\$ @DMGregory updated question \$\endgroup\$ – Daneolog Aug 6 '18 at 12:45
2
\$\begingroup\$

Create an sprite object that is the highlight. Make sure the location of the object corresponds to the center of the object. Then set its position as CellToWorld, using the WorldToCell result you already have.

This is the easiest way to do this. There would be another way using tiles themselves, but that is more complicated and honestly, you don't really need anything more complicated than this, since only one tile will be highlighted at a time.

\$\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.