Making the eight-directional virtual analog stick float

If all you want is an eight-directional analog stick, you're good to go! But, if you want the analog stick to float—appear where the players press and disappear when they lift their finger—you have to do a little bit more work.

To make the analog stick appear where the player clicks, complete the following steps:

  1. First, we need to create an area where the player will click to bring up the analog stick. Right-click Canvas in the hierarchy and select UI | Button to add a Button child to the Canvas. Rename the Button to Click Area.
  2. Remove the Text child object from the Click Area.
  3. Stretch the Click Area to fill the whole Canvas.
  1. Add some padding to the sides of Click Area by changing ...

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.