Wanzyee Studio

Execute click event on an object when the specified key pressed and this center clickable. More...

Inherits MonoBehaviour.

Public Attributes

KeyCode key = KeyCode.Escape
 The input key pressed to execute. More...
 
bool selfOnly = true
 Only execute if the clickable target is this, or allow other targets. More...
 
Camera camera3D
 The camera to get screen position, only used if this's on a 3D object. More...
 

Detailed Description

Execute click event on an object when the specified key pressed and this center clickable.

This executes all UnityEngine.EventSystems.IPointerClickHandler attached together. For raycast order of world space canvas and 3D object, you may set GraphicRaycaster.blockingObjects.

The main purpose and usage examples:

  1. Redirect the mobile back button, i.e., "Esc" key, to a UI button.
  2. Layout and map virtual keys with unchecked selfOnly flag.

Member Data Documentation

KeyCode key = KeyCode.Escape

The input key pressed to execute.

bool selfOnly = true

Only execute if the clickable target is this, or allow other targets.

Camera camera3D

The camera to get screen position, only used if this's on a 3D object.