Skip to content
Get a Eco Bag over €1000

News

Creating Touch Controls in Unity

by Shopify API 26 Aug 2024 0 Comments

Creating Touch Controls in Unity

Touch control allows you to interact with your device’s hardware and software. The touch controller receives your touch commands and relays them to the system, so the device can act accordingly. For example, if you touch an icon, the touch controller tells the device to open or execute that app.

There are a number of different types of touch controls, each with its own options to customize how it works. To create a new touch control, select the Touch Controller object in the hierarchy panel and then choose the type of touch control you want to add from the Add Controls area in the inspector.

The most common type of touch control is the button, which can be used to click or tap an object in your application. To create a button, simply select the Touch Controller object in the hierarchy panel then choose the Create Button icon from the Add Controls area in the inspector. The options for a button vary depending on what the button does, but they can include settings to control the appearance and behavior of the button.

A joystick is a kind of stick that can be moved around in a range of directions to perform actions. To create a joystick, select the Touch Controller object in the hierarchy panels then choose Create Joystick from the Add Controls area of the inspector. The joystick has a variety of options to control how it behaves, including whether it is a digital or analog stick, how it snaps to the initial position when touched and what direction its arrows point in.

If you have a joystick, it’s important to note that it should not be ordered after any other control objects (such as a Touch Region or a Custom Controller) that lock the anchored position of the control. This can cause the joystick to not move correctly and will also block raycasting from other control objects that are trying to capture input events on it.

Another thing to note is that you should not attach any Unity UI Layout components to the parent of a Touch Controller or Touch Joystick that have options such as Follow Touch Position or Animate on Return. This can cause the control’s Image to not update when its transition properties change, which can cause unintended or undesirable behavior.

Prev Post
Next Post

Leave a comment

Please note, comments need to be approved before they are published.

Thanks for subscribing!

This email has been registered!

Shop the look

Choose Options

Recently Viewed

Edit Option
Back In Stock Notification
this is just a warning
Login