The gaming industry has introduced some cutting-edge 3D games over the last couple of years.
Before we head on to the creation of a game in unity 3D, it is important to know what unity 3D is. The unity 3D game is a tool developed by unity technologies that is basically used for the development of 3D and 2D games. It provides game developers with a 2D and 3D platform to create video games on it.
Unity is one of the best platforms for developing a 2D or 3D game because it is more user-friendly than other game development platforms. Also, it is not important to hire a game developer for unity 3D game development. You can still develop a game even if you are a beginner. Below is how you can create a game in unity 3D- step by step.
1. Download UNITY-3D
The first step is to download Unity-3D on your Personal computer (PC) or mobile. The unity 3D is available for both android and IOS. Once you are done with downloading, the “welcome to Unity 3D” window will pop-up. Close the welcome unity window.
2. Create a project
The second step is to set up default as your choice. Then click on the “file” and choose a “new project”. Set the location for your project and type any name you want to give to your new project. You will see a button labelled "CREATE" on the bottom of your screen. Click on it to create your project.
3. Customize the layout
The third step is to customize the layout. Click the windows and drag them in a position. As an alternative, you can use the pre-installed layouts from Unity by selecting them from the drop-down menu next to Lay out in the top left corner of the screen. You use Unity's five primary windows the majority of the time. Among them are stated below.
The scene: Scene is where your game is being created. It displays the elements in your game and their positions in relation to one another. The spatial orientation of the scene is indicated by a block in the upper right corner.
Hierarchy: it lists all the elements which you have added to the screen. You can also add new elements by clicking create and selecting the type of object you want.
PROJECT: the project displays the files which are being used in the game.
GAME: shows the scene that the game's primary camera sees when it is active.
Inspector windows: This is where you can change the appearance of each element in the scene.
4. Save the scene
Click on the file on the top right-hand side of your screen and save the scene-assets.
5. Build settings
Go to files and click on build settings. There are a lot of platforms available, choose the one you desire. At the bottom of the Build Settings window, click Player Settings. From here you modify the name of the game and other related information.
6. Create the stage.
Add cubes in order to create a stage- Go to Game Object - Create Other - Cube, or choose from the Hierarchy window's Create menu. Insert a cube. Then, in the inspector panel, reset the transform of the cube, and then select the hierarchy and rename it "wall". If you are finding it difficult, you can ask an experience developer since its quite typical.
Then, create a long, wall-like cube by scaling it in the X direction. Duplicate "Wall" three times in the Hierarchy panel, for a total of four walls. Create a configuration that resembles an arena by dragging the cubes into place or by using each cube's transform options.
Utilize the Game Object dropdown at the top of the screen to create an empty Game Object (Create Empty). name it "Stage." Reset its transform. Drag all four "Walls" underneath the "Stage" Game Object.
Create a plane Game Object in the Hierarchy panel and use it for the floor. Rename it "Floor," and move it to the Stage section of the Hierarchy and enter the hit button after renaming.
In the end, give the floor by -0.5 in the Y direction and make the scale of the floor in the X, Y, and Z directions.
7. Creating a player and player controller
Select Game Objects - Create Other - Sphere from the menu. In the Hierarchy, select the sphere and rename it "Player." Reset the transform.
In the inspector window select newscript and name it as “player controller” and then choose a programming language. Hire a game developer in case you do not know programming.
Open the script for editing and double click name of script in inspector. This will open a mono-developing programming. Do the programming and save the file and switch back to unity game developer
Examine the movement script you just created in the player's Inspector panel. Now, Set the speed to a number between 100 and1000, and then press the play button at the top, middle of the screen. Test the balls and exit testing mode.
8. Adding the lights
Create an empty game object naming it “lights”. Now, In the Hierarchy panel, select the "create" toolbar option to create a directional light. Identify it as "Main Light." Drag it in the Hierarchy onto the game object for Lights to make it a child object.
Change the light settings for the Main Light to "Soft Shadows" and "High Resolution" in the Inspector panel while keeping Main Light selected. Then, Change the rotation of the main light in the Inspector panel to angle it down over the arena.
Now click the main light in hierarchy and duplicate It. Name the duplicate as “fill light” should be filled under lights. Change the color to a light blue tint and lower the intensity field to 0.1 to lessen the Fill Light's intensity. Change Shadows to "No Shadows." The Fill Light should be angled in the opposite direction as the main light.
9. Set the camera angle and make sure it follows the player
In the Hierarchy, select the Main Camera and adjust its transform until the image in camera preview (bottom right of the Scene panel) is correct.
We want the camera to move with the player around the screen. Create a script called "camera Movement" for this purpose by adding a newscript component to the Main Camera in the Inspector panel. A script will be opened in the Mono develop by double clicking.
Now add the newscript and drag it into the script folder, you made in assets. save the script, save the screen and save the project.
Create a new game object as cylinder. Repeat the format for creating a file and name it “item”. Insert the Item into the empty Game Object "Items." Restore their transformations. Create a rigid body for the Item. Duplicate the Item several times and scatter the copies around the arena.
11.Display the score
When the Player game object is selected in the Inspector panel, open the player movement script and make the necessary changes to enable the player to gather items and keep track of what it has obtained.
Declare your scores twice: once in a