Author Topic: How to Trigger a MouseClick from Script  (Read 6805 times)

col000r

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 3
  • Posts: 43
  • Mighty Emperor of Planet "Home Office"
    • View Profile
    • BLACKISH
How to Trigger a MouseClick from Script
« on: May 05, 2015, 03:55:06 AM »
I'm trying to make the mouse click and I need this to work no matter where the cursor is. And I want it to run its course through NGUI's event system just like a real mouseclick (ideally with all the OnPress, etc. being called as well.  (Basically what I'm trying to do is using the y-axis of a 3DConnexion SpaceMouse as a click, so the client can press on the big nob to click)

How can I do this? Is there a simple way to hook into this?

Because if I want to send OnPress, OnClick and everything, then I have to duplicate the entire logic behind that.
Games: BLACKISH | Blog | Assets

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to Trigger a MouseClick from Script
« Reply #1 on: May 05, 2015, 10:31:34 PM »
Just create a custom input (UICamera.onCustomInput) and call ProcessTouch the same way NGUI does. Check ProcessFakeTouches for an example.