Developing an MP3 player

In this recipe, we will see how to create a simple MP3 player with the Play, Pause, Stop, Next, and Previous buttons. Here, the focus will be on how to learn the interaction between UI and the Audio Source (Script) component within a script. Furthermore, we will see how to use the Event Trigger (Script) component to call all the functions in our script. These will actually implement the logic behind the MP3 player.

How to do it...

  1. First, we can create a panel by right-clicking on the Hierarchy panel and then clicking on UI | Panel. Rename it to MP3Panel. We should also resize it so that we can see the entire panel on the screen. This is the panel that will contain all the buttons of our player.
  2. Next, we need to create five ...

Get Unity UI Cookbook 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.