Creating a static four-directional virtual D-pad

A D-pad is simply four buttons on a directional pad. To create a D-pad for a mobile game, you just need to create a graphic that contains four buttons on the directions.

The art used in this example was obtained from https://opengameart.org/content/onscreen-controls-8-styles.

To create a virtual D-pad, complete the following steps:

  1. Create a new scene named Chapter10Example2 in the Assets/Scenes folder and open the new scene.
  2. Import the d-pad buttons.png sprite sheet into the Assets/Sprites folder.
  3. Change the newly imported sprite's Sprite Mode to Multiple and automatically slice it.
  4. Create a new Canvas with Create | UICanvas. Name the new Canvas D-Pad Canvas.
  1. The size of a D-pad is ...

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.