Helper scripts for input from touch devices

Along with Universal input system we provide easy and useful touch input elements (with multitouch support) those make development for touch-devices much easier:

  • touch_Button - allows to create touch button (visible only on iOS and Android) and read data from it.
  • touch_Stick - allows to create kind of analog stick (visible only on iOS and Android) and read data from it. Accelerometer_control - allows to read data from gyroscope

touch_Button description

Average structure looks like:

 

To make touch_Button just create GUITexture object and setup its position, size and texture. Setup “Scale on Touch” if you want to have scaling effect in time of touch. Check “Debug Info” checkbox if you want to bring some useful debug info to the screen. Use function “isTouched()” to get info is element touched or not.

 

touch_Stick description

Average structure looks like:





To make touch_Stick just create GUITexture object and setup its position, size and texture. Read “position” variable to get normalized stick offset from initial position. Setup “Active Area Size” to specify screen-limits (start position is in the center) where stick can be moved. Setup “Scale on Touch” if you want to have scaling effect in time of touch. Check “Debug Info” checkbox if you want to bring some useful debug info to the screen. Use function “isTouched()” to get info is element touched or not.


Accelerometer_control description


Average structure is extremely simple.

 

Check “Debug Info” checkbox if you want to bring some useful debug info to the screen.
To use Accelerometer_control just assign it to any game object.