2D Toolkit Forum

2D Toolkit => Support => Topic started by: hyundev123 on March 14, 2015, 04:55:44 am

Title: Tilemap detect touch/click
Post by: hyundev123 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!
Title: Re: Tilemap detect touch/click
Post by: unikronsoftware 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.
Title: Re: Tilemap detect touch/click
Post by: hyundev123 on March 15, 2015, 09:46:20 pm
Ah right! That is simple/clear way. Thank you! :)