How to Create your First Game App Using Unity?
Unity is a game engine that assists game developers and designers to plot out a game or app scenes. This game engine comes really handy to the users, especially for beginners. With an unsurpassed and multi-platform or cross-platform feature, Unity is accepted by both “hobby developers” and various gaming studios. Popular games like Pokemon Go, Call of Duty, monument valley are a few examples that are made with the help of the Unity game engine. There are several game development courses where you can learn much more about video game development.
A Splash of History About Unity
This gaming engine was first publicized and released in the year 2005 at Apple Inc’s worldwide developer’s conference under the name MAX OS-X exclusive gaming engine.
Unity additionally permits to import and assemble assets, writing code to move with the objects to make or import animations to utilize in an exceedingly work with an advanced animation system and much more.
Well, in unity you can do programming in C#, Java and even one of the similar languages of python I.e Boo. In this article we will discuss how to make your first game app using Unity. Although you don’t need to be pro at any of these programming languages, right now. But it is really recommended to learn these coding languages as they are an absolute backbone for making games.
Just follow the instructions and you can also create your own game using Unity 3D, So let’s begin:
STEP 1: Creation of your Project
At first, Open Unity 3D
Close the window “welcome to unity” which pops up by default.
Choose “New project”
(Pro tip: Create a dedicated folder to hold all your unity projects) then, select the location of the project which you are doing. And then create a name to your project. Please follow the above Screenshot which is given above the text.
Then, click “create”.
STEP 2: Understanding the IDE
While using unity there are five main windows. Those are scene, game, hierarchy, project, and inspector windows. We have already given the screenshot, which will help you to follow up!
Now getting to the point:
Part (A): this is the part where all the game-making takes place. It manifests what are the elements which you will have in your game and where they are relative to each other.
Choose a block that is in the upper right corner of the screenshot which is present right above the text and which is showing the spatial orientation of the scene.
Game (B): It is showing the view that the main camera sees when the game is being played. This is the window where you can test your game just by clicking the play button which is on the top. Check the center of the screen.
Hierarchy (C): It lists all the elements which you have added to the scene. New elements can be created just by clicking on the “create” option and selecting the type of object which you want in your game. It can also be done by choosing the “GameObject” dropdown menu which you will find at the top of the screen.
Project (D): It shows all the files which can be used for your game. You may create the folders, scripts, etc, just by clicking on the “Create” option which is right under the project window.
Inspector (E): this is the option where you can customize each and every element which is in the scene. You will have to select any object in the hierarchy window or you can also double click on any object which is in the Scene window which shows its attributes which is in the inspector panel.
STEP 3: Try to Save the Scene and Set up the Build
Choose the File option and then save the screen. Now you have to save the screen [ project name] under the folder. Here, you have to note that assets is a pre-made folder where you can store all your scripts and scenes. We will suggest you create a folder named scenes within the assets as the assets folder tends to become messy.
Try to save the scene named Scene or Main or something which you like and then
Click File – Build Settings.
Add the current scene which you have created to build.
Select your desired platform. although there are lots of options like game systems, computers and smartphones as well but if you are making your projects for the first time then, selecting Web Player or PC/Mac/Linux Standalone will be a better option.
Then, you can click on the Player Settings which you will find at the bottom of the Build Settings window. Then it will automatically open the player setting option which is in the inspector. Here, you can change the name of the company or the name of the product (which is the game), default icon etc.
After doing all these then close the build settings window, here you will automatically come back to the place when you are ready to finish the product (game).
STEP 4: Creation of the Stage
It is a very simple way where you can create a stage by just adding cubes ( the feature which is available in Unity).
Move your cursor to “GAME OBJECT”- create other- you can use the create menu which is in the hierarchy window and then add a cube.
Now, you have to reset the cube’s transformation just by right-clicking the “ TRANSFORM” option which is in the inspector panel. To be honest, it is a really well practice to do this whenever you are creating a new Game Object.
Now, you have to select the cube which is in the hierarchy, and do rename it as “ Wall” by double-clicking its name which is in the hierarchy or you can also use the inspector panel as well .
Try to scale the cube in the X direction to enlarge it or to make it long and wall-like.
right-click on the “wall” which is in the Hierarchy panel, and try to duplicate it three times, so that you can have four walls. But the thing is, it will look like as if you have only one wall as they will be identical and therefore it will also occupy same point in terms of space.
Continuation of Step 4
Now you will just have to drag them into their positions so that it looks like an arena.
Now, make an empty GameObject, with the use of the Game Object dropdown (Create Empty) which you will find at the top of the screen. Call it a “Stage” and reset its transform.
Select all the four “walls” that you have created and try to drag them using the option the “ Stage” game object.
Well, now you will have to add a plane Game Object just by clicking and selecting “ Create” which is in the hierarchy panel, and just use it for the floor. And also don’t forget to rename it “Floor” and drag the object under the stage in the Hierarchy option.
You have to give the floor a -0.5 Transform it in the Y-direction to make sure it will line up neatly along with the four walls.
The floor’s scale will have to be in X, Y, and Z directions where 1/10 of the scale which you have used to size the walls.
STEP 5: Player’s Creation
Go to the Game Objects- and then, create another- Sphere.
Now you have to select the sphere which is in the Hierarchy and then rename it “ player”. And also reset its transform.
Now, add a component at the very bottom of the inspector panel and the player selected. Add Physics- Rigidbody. And leave all the default settings.
Here you will notice that each of the objects comes with a variety of components which is added. Where you can see in the Inspector.
The shapes like cube, sphere, etc all of them has a component called a “Collider”. here, in this physical area of the screen, the object is regarded to take up space and if you switch off the collider then the object seems like a ghost which will be able to pass through other different objects.
You can both turn the components on and off just by checking and unchecking the boxes which are just next to the component’s name. ( Refer to the picture above).
STEP 6: Player Movement
STEP 7: How to Add Lighting
For creating sunlight effects on your scenes, the directional lights are really useful. They are the distant light sources that exist in infinitely far away, its characteristics are a lot like the sun. And every unity scene contains a directional light.
In the game Engine Unity, it is very much linked to the procedural sky system which is defined in the environment lighting section of the lighting panel (Lighting>Scene>Skybox).
Interestingly you can also change the behavior by deleting the default directional light and making another lighting simply by specifying a different Game Object from the ‘Sun’ parameter (Lighting>Scene>Sun).
STEP 8: Alter the Camera Angle
Choose the main camera in the hierarchy. Then, keep adjusting its transform till the image in the camera preview looks nice.
We have used (0, 10, -13) for the position and (45, 0, 0) for the rotation. Well, you can also drag the camera around the Scene View.
STEP 9: Making Different Items
You can create a new game object, it might be a sphere or a cube, or a capsule. Although, we have used a cube. Use the name “ pickup”.
Now, just after selecting the tags, tag the item as “pickup” and create a new tag called “pickup”. Then, after going back to Tags for that game object and selecting the new “Pickup” tag that you created.
Tag all other items which you have created as “items”. Please do make sure that you have used the spelling and capitalization perfectly.
Place each and every item into an empty game object named “pickup”.
Again, reset the transforms and add a rigid body to the item.
Now you have created a material, by right-clicking on the project window- Create material and then change the color and drag the material into pickup object.
Drag the object into the prefab folder which you can see in the project window. A prefab of the object will be created. The prefab system in Unity allows one to configure, store a game object and create it as well. It also acts as a template where you can also create new instances in the scene.
Last but not least duplicate the item, a bunch of times and put the copies around the area of your creation.
STEP 10: Collection of the Items by the Players and Score Display
From the canvas, the component adds the text so that it can display the counts. And for that right-click in the hierarchy window- then, to the canvas- text.
Now, for displaying the counts add a text from the canvas component. Do a right-click in the hierarchy window then canvas- text. Choose any name as you want, we have used “ Counter text”. The duplicate the text in the game objects and rename it as win text, Collision Point, and Ball Velocity.
Now you have to open the script from the Inspector panel for the movement of the player and select player game object.
Now you have to modify the script and allow the player of the game to collect and keep a list of the items which he has collected.
Continuation of step 10
Now, you have to make two declarations:
- There will be variable that will keep a track of your score
- Graphical User Interface ( famously known as GUI) text which will be displaying your score on the scene view.
Under the function of the void start(), initialize count and SetCountText.
Type a Function for Player Colliders with the Items
Now you have to write the SetCountText Function, Which updates the score on Display.
Click on save and come to your unity, then select your all items, check your all buttons
Now you Have Created your Own Game App on Unity
See this just a layout of how you can create a game. For more knowledge and understanding we will suggest you learn game development. This is for your own betterment and for your success in this industry.
There are various Mobile Game Development Courses from where you will get an in-depth knowledge
Also Read: How to make a career in Gaming Industry