Game Framework provides support to make things like reacting to user input simpler.
Escape Input
There are 2 components that let you react the escape key or corresponding button for different platforms (e.g. android back button) being pressed. OnEscapeLoadLevel will load a specified scene, automatically running any transitions if you have the Beautiful Transitions asset installed. OnEscapeQuit will cause your game to exit.
Mouse Button / Tap Input
The Abstract component OnMouseClickOrTap forms the basis of several other components that react to a mouse button being pressed or tap input. It provides a simple RunMethod that you need to implement that will only be called if a click / tap is detected and it isn’t over an optional list of other gameobjects. This will stop any input to UI elements ‘falling through’ and being processed also by this component. OnMouseClickOrTapLoadLevel will load a specified scene, automatically running any transitions if you have the Beautiful Transitions asset installed. There is also a component within the UI|Dialogs section OnMouseClickOrTapSwapDialogInstance that allows for switching between dialogs.
Helper Class
The InputHelper class provides a number of helper methods and functions for handling and working with input. See the API documentation for further details
See also
- API Documentation
- Getting Started with Game Framework for Unity – Part 1 – The Basics, Audio, Settings and Localisation
If you have any thoughts or suggestions on improvements or additions to the Input features then please let us know!