UICamera script is a key component of every functional UI. It’s responsible for sending out NGUI events to the colliders of all objects drawn by that camera. If you have one camera in the scene, make sure it has UICamera script on it. If you have more than one, make sure that at least the camera that’s drawing the UI has it. Placing this script on your main camera used to draw your scene allows your in-game objects to receive all the OnClick, OnHover, OnDrag and other events as well.
- Use Mouse determines whether the camera is going to react to mouse events.
- Use Touch turns touch event handling on or off.
- Use Keyboard will allow the keyboard events to be sent out (OnKey).
- Use Controller will allow the joystick-based events to work (also via OnKey).
- Event Receiver Mask determines which layers will be eligible to receive events. Generally you will want it to match the Culling Mask on the Camera.
- Tooltip Delay controls how many seconds the mouse needs to be stationary for before an OnTooltip event is sent out to the hovered object.
- Mouse Click Threshold controls how far the mouse is able to travel after OnPress(true) event before it’s no longer eligible for OnClick().
- Touch Click Threshold is the same, but for touch-based devices.
- Range Distance determines how far away the objects are able to receive events from the camera, if the value is above zero. Below zero means “as far as the camera can see”.
- Scroll Axis Name lets you change the axis used for the OnScroll events.
- It’s possible to use UICamera without using the rest of the NGUI system just for the handy event system feature.