How To Make A Good Animated Main Menu Background For Your Unity Game
Make a Good Looking Championship Screen in Unity
Introduction
In this tutorial, I will guide you lot on how to make a simple adept looking title screen or you may call it the principal menu, in Unity Engine. I will teach y'all how to animate your buttons, add together sound effects on hover, and how to switch scenes on click. You tin too follow this tutorial onYouTube.
Getting Started
To start making a good-looking championship screen for your game, set up your title scene by adding different texts that will soon be given a button functionality. In my case, 3 buttons will exist added, which are: Play Game, Options, and Credits buttons. I gave each text different color to make the scene looks more colorful. I changed the font and resized the text elements.
Animating
The buttons won't be cool if there are no animations. So permit's animate the buttons on hover. Past "hover" I mean whenever the mouse cursor is over a push button.
Open the Blitheness window by going to Window > Blitheness > Animation or past pressing Ctrl + 6 (Windows) / Command + 6 (Mac). Now create an Animator Controller by Right-Clicking on the Project folder > Create > Animator Controller. Select all the buttons and drag and driblet the animator controller into the inspector. Now select ane push and click create on the animation window.
Beginning animating past pressing on the timeline, so printing record to start recording the animation. At present change the font size to make it bigger, then stop recording. Now all the buttons should have the same animation since all of them take the same animator controller. Create another animation to scale the font down past doing the same blitheness but in contrary.
Now go to Window > Animation > Animator to open the animator window. Select the animator controller from the project folder to view the animation in the Animator window. Correct-Click on the blank space to create a new empty state, rename information technology to "Normal" and go far the default layer.
Now make a transition path from the normal state to the size up blitheness land, and from the size upward animation land to the size down blitheness state, and finally from the size down animation country to the normal state.
Now Select the buttons and make sure they all have the Push component. Under the Button component, change the button transition to Animation.
Dorsum to the animator window, go to the Parameters tab and click the plus sign to add new triggers. First, add a trigger called "Highlighted", and then create another trigger called "Normal". After that, click on the transition line between the Normal and Size Up animations and disable Has Exit Time and Stock-still Duration, and set transition duration to goose egg. Add a condition and select Highlighted. Now select the transition line between the Size upward and the Size down animations and exercise the same things but this time, the condition will exist Normal. And so select the terminal transition line and set the transition duration to nix.
Sound Effects
Kickoff, create a new empty gameObject and rename it to "Audio". Then, create a new C# script chosen "Destroy"; this script will remove the audio from the scene when information technology finishes playing.
Go dorsum to Unity, and select the Audio we created. Drag and drop the Destroy script into the gameObject. Now add a component called Audio Source and select the audio effect of your pick (import your sound event to the project folder). Brand sure the Play On Awake is checked and loop is disabled.
Now, elevate and drop the Audio gameObject into the project folder to brand it a prefab and then remove it from the scene. Later that, create a new script called "PlayAudio"; this script will instantiate the Sound prefab to the scene.
Go back to Unity, and select the Main Camera the drag and drop the script into the inspector. Then, select the Audio prefab to be the audioObj.
Select All the buttons and requite them a new component chosen Event Trigger. Now you take to brand the component changes to the buttons one-by-ane. Select a button, and nether the Event Trigger Component, click add new result blazon and select Pointer Enter. And so, click the plus sign and cull the Main Camera and Select the DropAudio function. Now exercise the aforementioned steps to the other buttons likewise.
To switch between ii scenes, first you have to add them in the Scene Alphabetize. Go to Files > Build Settings or Ctrl + Shift + B (Windows) / Command + Shift + B (Mac) to open up the build settings window. At present, simply drag and drib your scenes into the build settings window. On the right of each scene there volition be a number; these numbers are the index numbers that we will use to switch between scenes.
Now create a new C# Script and call information technology "SceneSwitcher"; this script volition switch the scene depending on the index value nosotros give.
Go back to Unity, and elevate and drop the script to the Main Camera. Then, select the buttons and give them the functionality from the Main Photographic camera's SceneSwitcher script. Now you will take to give an index value. For example, if the credit scene index number in the build settings window is 'ii', then you will have to type 2 for the Credits push.
Source: https://www.mousawidev.com/blog/make-a-good-looking-title-screen-in-unity
Posted by: penaectilow.blogspot.com
0 Response to "How To Make A Good Animated Main Menu Background For Your Unity Game"
Post a Comment