Examples
In this chapter, we are going to cover a few examples of frequently used mobile-specific UI interactions.
Adding press-and-hold/long-press functionality
Press-and-hold is utilized frequently in mobile games. Many games that use right-click on the PC or web use press-and-hold when they are converted to the mobile platform.
To demonstrate how to implement Press and Hold
functionality, we will create a button that has a growing ring that represents hold time. Once a specified amount of time has passed, a function will fire:

When working this example, it is important to remember that even though the code is referencing a pointer, this functionality does not work exclusively with a mouse. Placing a finger on a touchscreen functions in the same way as a pointer down, and picking up the finger works the same as a pointer up.
To create a button with a growing ring that represents hold time, complete the following steps:
- Create a new scene named
Chapter10Example1
in theAssets/Scenes
folder and...