- Home /
Question by
vedvishal100 · Feb 25, 2017 at 10:01 PM ·
uiinputtouchmouseclick
Touch a specific area on the screen
I am building a Roulette game in Unity 5. I want to place bets on a Roulette table when I touch specific areas on the screen with mouse(PC) and touch(mobile).
For example when i touch Number 1 on the roulette table a bet should be placed on that number. I tried using box collider iwth trigger but I think thats for only colliders.
Screenshot attached
roulettenumbers.png
(145.3 kB)
Comment
Answer by alexander9727 · Feb 26, 2017 at 08:51 AM
If your game is a flat 2D game you can use the GUI Button to achieve this by placing multiple buttons where you need them. Otherwise you can use a screenpoint to ray and get which object it hit or you can use an OnMouseUpAsButton() on each item and then get what object it was.