A One-Stop Solution Guide to Understanding C# Unity and Its User Interface

There is a wide range of resources available to help create video games. Custom file formats are frequently created by developers using tools that convert 3D models and graphic image formats. Assets are viewed before they are included in the game using level editors and other tools. For the most part, game development tools are either developed in-house by the developer for a single game or are provided by the console maker (such as Nintendo or Microsoft) as part of an official game development kit. Unity 3d is an example of this kind of software.

Here's How to Land a Top Software Developer Job

Full Stack Developer - MERN StackExplore Program
Here's How to Land a Top Software Developer Job

What Is C# Unity 3D?

C#Unity-What-img1

Unity3D is a user-friendly development environment and a strong cross-platform 3D engine. Unity should appeal to everyone who wants to create 3D games and applications for mobile, desktop, the web, and consoles. It is simple enough for beginners and powerful enough for experts. 

Now that you have a good briefing on unity 3D Software, look at the Installation process of Unity 3D.

C# Unity 3D Installation

C#-Unity-Download-img1

1. First, you will go to the Unity 3D Download website. 

https://unity3d.com/get-unity/download

Here, you will download Unity Hub.

C#Unity-instal-hub-img1.

2. Then, you must open Unity Hub Setup and do the installation.

C#-Unity-instal-hub-img2.

3. Now, open Unity Hub and go to the install tab to install an editor.

C#Unity-instal-editor-img1.

4. Now, you must select the recommended editor to install.

C#Unity-instal-editor-img2.

5. Now, you must select the option to install visual studio if it's not installed already and click on install.

Now, you will install the unity extension package for your Visual Studio. 

C#-Unity-instal-VS-img1.

Learn the Ins & Outs of Software Development

Caltech Coding BootcampExplore Program
Learn the Ins & Outs of Software Development

1. So, open the Visual Studio installer. And click on modify.

C#-Unity-instal-VS-img2

2. Then you must go ahead and select Game development with Unity Extension and click on Modify.

And with this final step, Unity is successfully installed and ready to use on your system. Now, you will understand its User Interface.

Now, start with creating your first project. 

C#-Unity-Create-Project-img1

1. Open the unity hub and click on New Project.

C#-Unity-Create-Project-img2

2. Then you must select "3D" to do a 3D project; then, you must give it a name, say, "Demo," and click "Create project."

C#-Unity-Create-Project-img3

3. You have to wait a few seconds for the editor to start the project.

C#-Unity-MainScene-img1

And this is the Unity Project.

Now, you will look at each UI Component one by one.

C# Unity 3D User Interface

C#-Unity-MainSceneTabs-img1

  • First, you have two tabs at the top - Scene Tab and Game Tab.

C#-Unity-SampleScene-img1

  • A sample scene tab would look like this.

C#-Unity-Gameviewtab-img1

  • Then, you have the Game View Tab.

C#-Unity-GameobjectDirectory-img1.

  • Now, look at the hierarchy tab. This tab will contain all the Game objects for a game project. By default, a project comes with two game objects - the main Camera and Directional Light.

C#-Unity-GameAssetDirectory-img1

Here's How to Land a Top Software Developer Job

Full Stack Developer - MERN StackExplore Program
Here's How to Land a Top Software Developer Job

  • Then, you have the Project tab at the bottom. This tab essentially contains all game asset files like scenes, materials, prefabs, textures, animation, Sound, etc.

C#-Unity-Console-Tab-img1.

  • Next, you have Console Tab, and this is where all the errors and warnings will be listed when you debug your projects.

C#-Unity-inspecter-tab-img1

  • Next, select a game object like the main camera. Have a look at the inspector Tab on the right. 

If you look carefully, you will find some components in the inspector tab.

C#-Unity-inspecter-tab-img2

  • First, you have the Transform component. This component will decide the game object's position, rotation, and size. 

C#-Unity-inspecter-tab-img3

  • Then you have another component named the camera. It is responsible for more camera-oriented settings like depth, the field of view, etc.

C#-Unity-Toolbar-img1

  • You also have a Toolbar on the scene tab with different buttons responsible for certain actions.

Unity-toolbar-viewtool-img1

1. First, you have the "view" tool in the toolbar. It is responsible for viewing around the scene map.

-Unity-toolbar-movetool-img1.

2. Next, you have the "move" tool in the toolbar. It is responsible for moving the game objects around on the scene map.

-Unity-toolbar-rotatetool-img1.

3. Then, you have the "Rotate" tool in the toolbar, responsible for rotating the game objects.

Unity-toolbar-scaletool-img1.

4. After that, you have the "Scale" tool in the toolbar. It is responsible for increasing the game objects' length, width, and height. 

Unity-toolbar-Recttool-img1

5. Next, you have the "Rect" tool in the toolbar. It is responsible for increasing the size of the game objects while maintaining their length, width, and height constant.

Unity-toolbar-Transformtool-img1

6. At last, you have is "Transform" tool in the toolbar. It is responsible for every action that every other tool except the view tool in the toolbar.

Now that you have brief knowledge about Unity 3D and its UI, do a small project.

Here's How to Land a Top Software Developer Job

Full Stack Developer - MERN StackExplore Program
Here's How to Land a Top Software Developer Job

C# Unity Game Object Creation

Now, start with creating a few important folders in the asset tab.

Unity-Project-folder-img1

1. You can right-click in the project tab, click on Create, and select the folder to create one.

Unity-Project-folder-img2.

2. You must create multiple folders like Script, Materials, Textures, Prefabs, Sound, Animations, etc.

Now, go ahead and create a 3D Game Object like Cube

Unity-Project-gameobject-img1.

1. To create a Cube, you must right-click on the hierarchy Tab, click on 3D Object, and select the cube. 

C#Unity-Project-gameobject-img2

Here is the Cube:

Unity-Project-gameobject-img3

2. You can now select the cube, see the inspect menu, and move, scale, or rotate it around anywhere on the scene map.

Now, create a material to give color to this game Object.

C#-Unity-Project-Material-img1

1. You will go to the materials folder and right-click to select create and choose the material. 

C#-Unity-Project-Material-img2

Become a Certified UI UX Expert in Just 5 Months!

UMass Amherst UI UX BootcampExplore Program
Become a Certified UI UX Expert in Just 5 Months!

2. You can name it GreenMaterial as we will give it a green color. 

C#-Unity-Project-Material-img3.

3. Now, by default, materials are white. So to color them, you must go to the inspector tab of that material and click on the color palette.

C#Unity-Project-Material-img4

4. After choosing the color, you can drag the material over to the game object to apply it.

You have now explored Unity and its User interface. You have also learned to create a game object. Now, write a script for the Game Object.

C# Unity Script

1. To create a script, you will first go inside the scripts folder.

C#-Unity-Project-Script-img1

2. Then you must right-click on the space and click on create and select C# Script.

C#-Unity-Project-Script-img2.

3. You will name it "Movement." Make sure to name them correctly. If you are a beginner and make a mistake, then it is better to delete the script and remake it with the correct name, or you might face errors while debugging.

4. You can double-click on the script to open it in Visual Studio.

This code will be responsible for moving the game object around in the game view.

Code:

//Movement Script to move the game object

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class Movement : MonoBehaviour

{

     void Start()

    {    

    }

// Speed by which the block will move

    public float velocity = 3;

    // Update is called once per frame

    void Update()

    {

        Transform transformCam = Camera.main.transform;

        Vector3 positionOfCam = new Vector3(transformCam.position.x, transform.position.y, transformCam.position.z);

        Vector3 movingDirection = (transform.position - positionOfCam).normalized;

        Vector3 movingForward = movingDirection * Input.GetAxis("Vertical");

        Vector3 movingHorizontal = transformCam.right * Input.GetAxis("Horizontal");

        Vector3 movement = Vector3.ClampMagnitude(movingForward + movingHorizontal, 1);

        transform.Translate(movement * velocity * Time.deltaTime, Space.World);

    }

}

C#-Unity-Project-Script-img3

5. You can save it now. Then, you must go back to your Unity and drag the Movement Script over to your GameObject Cube to apply it.

With this, you have a good grip on the fundamentals and User Interface for working with C# Unity 3D.

Master front-end and back-end technologies and advanced aspects in our Post Graduate Program in Full Stack Web Development. Unleash your career as an expert full stack developer. Get in touch with us NOW!

Next Steps

The next lesson in your C# training can be "How to create a game in Unity." You will be creating an Endless Runner game. Endless Runner is a game where the Player moves forward constantly while earning points and avoiding obstacles. The basic goal is to finish the level without falling into or clashing with the obstacles. Still, the level frequently repeats itself indefinitely, gradually increasing the difficulty until the Player collides with an obstacle.

Simplilearn is the world's most popular online Bootcamp for developing skills in the digital economy, and it's here to assist you in doing just that. Digital marketing and data science are just two topics we cover extensively in our online courses.

Simplilearn teamed with the Caltech CTME and the Indian Institute of Technology, Kanpur, to deliver their Software Development courses. These courses cover the fundamentals of data structures and algorithms and more advanced subjects such as Competitive Programming. As a software engineer, you will learn about data structures such as trees, graphs, and queues.

The comments section below is open for questions and comments about this 'C# Unity' tutorial. Happy learning!

About the Author

Vaibhav KhandelwalVaibhav Khandelwal

Vaibhav Khandelwal is a proactive tech geek who's always on the edge of learning new technologies. He is well versed in competitive programming and possesses sound knowledge of web development. He likes to read fictional and sci-fi novels and likes to play strategy games like chess

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.