![]() After the animation ends, we want players to enter the game scene. We will scale the play button down, then scale back to its original size when it’s clicked to create the effect that we’ve pressed and released. We can change a lot of properties for the button for example, rect Transform properties, image properties, or button properties. Unity has a great animation tool which we’re going to use on the play button we just added. The game should look something like this: I will use a play button image and delete the text object. You can either add an image as a sprite for the button and delete the text object as shown in the image below, or use it as it is. To do so, right click in the hierarchy, add a button, and name it “Play”. We’ll next add a play button that will take players to the game scene so they can start playing. Move the image towards the top-center part of the scene: Drag the image from your assets folder and drop it into the hierarchy as shown below. First, let’s add an image for the game’s name. Now we’re ready to make the main menu scene. Since we don’t need the text object inside the canvas object, we can delete it. Do so by adding the Main Camera in the Render Camera field in the inspector of the canvas (as shown below): Now we have the same background image, but we need to center it. If we want, we can edit the background image later. Return to the TapGame scene and copy the canvas and the EventSystem from the hierarchy, and paste it in the “Menu” scene as shown below. We will use the same background we used in the game scene. Let’s add a new scene and name it “Menu”. You will have the opportunity to add more features to the game later. I personally prefer adding a new scene because the larger the game becomes & the more game objects you have in a scene, the heavier the scene is. To create a main menu for our game, we can add a new scene or create a popup window in the same scene. In this tutorial, Unity Version “2020.3.23f1” is used. ![]() The following should be installed on your computer to follow along this tutorial: In this article, we are going to create a main menu, add sounds to the game, animate buttons, pause, & finally, exit the game. You can check out my intro article, where I dive into Unity editor basics, or dive right into part 1 of our “Developing your first Unity game”, where we begin developing our Frog Unity game and I dig a bit deeper into a couple important game object components, and then part 2 of our “Developing your first Unity Game”, where I walk-through adding a falling effect, instantiating several prefabs in random places, & making and displaying a score counter. Welcome to the final article in this Unity series where we are developing a Unity game.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |