Author Topic: clicked position on a sprite  (Read 5673 times)

zenmaster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
clicked position on a sprite
« on: April 13, 2013, 07:50:02 PM »
Hi All,

I have a Button with a background Sprite of a circular gauge.
OnClick() is getting called when I click on the button which i expect.
How do I get the clicked position on Sprite?
I was expecting all the event handlers to be passed an event object?

Thanks

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: clicked position on a sprite
« Reply #1 on: April 14, 2013, 08:37:55 AM »
I think you can use

  1. UICamera.lastHit

to get a RaycastHit inside the OnClick.

You can also use

  1. UICamera.currentTouch

to get a "MouseOrTouch" instance that has a bunch of info. (see in the top of UICamera for definition).

zenmaster

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: clicked position on a sprite
« Reply #2 on: April 15, 2013, 10:58:17 PM »
Thanks for info.
lastTouchPosition has some coordinates that I still need to transform?
UICamera.lastHit has lots of data.