Author Topic: Object to follow mouse cursor in UI layer  (Read 4899 times)

DJVDJV

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Object to follow mouse cursor in UI layer
« on: July 19, 2015, 01:40:04 AM »
Make object to follow mouse cursor in game is pretty easy:

Vector3 pos = Input.mousePosition;
transform.position = Camera.main.ScreenToWorldPoint(pos);

But I don't fully get how to make object to follow mouse cursor in NGUI?

I tried make it as in NGUI Tooltip (Just updating position every frame).. but I don't fully get idea.

So:
What is short (And right) way to make object to follow camera in NGUI?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Object to follow mouse cursor in UI layer
« Reply #1 on: July 21, 2015, 11:26:24 AM »
Use transform.OverlayPosition.