Creating the menu approach 1

In this first approach, we'll create a menu that uses a transparent background texture as a GUI Texture, in the same way as we have just done with our main title logo.

We will then need to write a script in order to make the texture receive mouse events for mouse enter, mouse exit, and mouse down/up.

Adding the play button

In the Menu folder in the Project panel, select the texture called PlayBtn. Go to GameObject | Create Other | GUI Texture. Select the PlayBtn object in the Hierarchy that you have just made. In the Inspector, set its Transform position to (0.5, 0.6, 0.

GUI Texture button script

This is the first of our three buttons, and because they all have common functions, we will now write a script that can be ...

Get Unity Game Development Essentials 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.