Author Topic: How to use UICamera.OnCustomInput?  (Read 3034 times)

tr1stan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
How to use UICamera.OnCustomInput?
« on: April 09, 2014, 02:35:22 AM »
Hello,

I'm going to use NGUI with joystick controller. I want to simulate a mouse with a sprite and the camera do raycast through the sprite position. I saw on this forum many people suggest using onCustomInput delegate, but how to use it? Thanks if anyone can post a code snippet.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to use UICamera.OnCustomInput?
« Reply #1 on: April 09, 2014, 03:44:21 AM »
If you do a search on this forum for "onCustomInput" you will find quite a few posts. The basic idea is that you set UICamera's onCustomInput to your function, and inside you do your own logic that determines where your custom pointer is located, which button got pressed, etc. You will then perform a UICamera's Raycast, then call UICamera's ProcessTouch function passing whether the button was pressed and/or unpressed.

Easiest example function to use is UICamera.ProcessFakeTouches().