Hello Guest

Author Topic: Tilemap detect touch/click  (Read 3149 times)

hyundev123

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Tilemap detect touch/click
« on: March 14, 2015, 04:55:44 am »
Hi,

This is my scenario to implement:
1. There is tilemap :)
2. User click and drag on the tilemap
3. Then, move camera based on that. (Basically, scrolling effect)

I think I got how to handle camera movement based on the clicked and dragged position, but don't know how to detect tilemap easily.

Is there a quick way to detect?

* Sorry, I am new on Unity.

Thank you!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap detect touch/click
« Reply #1 on: March 15, 2015, 02:20:10 pm »
You can work out if you've clicked on the tilemap by using tilemap.GetTileAtPosition
It returns true if your world position is in the bounds.

hyundev123

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Tilemap detect touch/click
« Reply #2 on: March 15, 2015, 09:46:20 pm »
Ah right! That is simple/clear way. Thank you! :)