O'Reilly logo

Unity 5.x Game Development Blueprints by John P. Doran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding main menu buttons

Now that we have the text displaying correctly, let's add in the ability to move from the main menu into the game and quit the game.

  1. Start off by going to the top menu bar and then selecting GameObject | UI | Button.

    At this point, you will see a new child object to the Canvas called Button and if you were to extend that object, you'd see that it has a Text child as well.

  2. Next, let's learn a new way that we can position objects. From the Hierarchy tab, select the Button object and open up the Anchors Preset menu and from there select the bottom-stretch option.
    Adding main menu buttons

    Notice now that Pos X and Width have been replaced with a Left

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required