Multi-touch input

Touchscreen devices generally have the ability to access multiple touches. The most common usage of multi-touch allows the player to pinch to zoom. Accessing multi-touch is pretty easy. You access touches with Input.GetTouch(index), where the index represents the index of the touch, with the first touch occurring at index 0. From there, you can access information pretty much in the same way as accessing information about a mouse.

You can also find out how many total touches are occurring with Input.touchCount.

You can find an example of how to implement pinch-to-zoom functionality here: https://unity3d.com/learn/tutorials/topics/mobile-touch/pinch-zoom?playlist=17138.

Get Mastering UI Development with Unity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.