Making a 2D Game in unity part-7

First we will make an ui frame for the game. we will need a pause button in the game scene. this is our ui image when the game is running.

1.png

we will also need a pause panel.pause panel appears when we make them pause. It contains this is our pause panel.

2.png

after making this ui image we will disect the frame and save every image elements individually. Now import all images in unity. Make a canvas in hierachy. Here is my setting for canvas.

9.1.PNG

this seting will make the ui flexible with any screen size. so handelling different device will not be a problem for the interface.

now create 4 empty game object as a child object of canvas. name them

-pause -pause panel -score -gameover panel

Make a button as a child object of the pause game object and adjust its size and position and image. select the pause button from hierachy. left on the plus button of on click section.

pause.png

you will get a slot and a function selection in the right. drag and drop the manager game object in the button slot and select manager>pause from the function selection option.

make 4 button as child object of pause panel. adjust there size and position. set a panel image. the buttons will be

-main menu -resume -restart -quit

select main menu button and drag and drop manager game object from hierachy in the menu button slot and select main menu function.

menu.PNG

select resume button and drag and drop manager game object from hierachy in the menu button slot and select resume function.

resume.PNG

select restart button and drag and drop manager game object from hierachy in the menu button slot and select restart function.

restart.PNG

select quit button and drag and drop manager game object from hierachy in the menu button slot and select quit function.

quite.PNG

make a text ui and set it as the child object of score gameobject. adjust its size position and image. name it "score"

score.PNG

make 3 buttons as child object of gameover panel. adjust there size and position. set a panel image.

3 buttons will be -main menu -restart -quit

set it similarly.

AUTHOR

READ NEXT

Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?