Hello, welcome to our Unity 101 video series. This is series will help you to get up and going with Unity as quick as possible. Every week I will publish a blog post that will take accompany you on your journey to use Unity for game development.
First, I'm going to start with explaining what Unity is and how to install it along with Visual Studio. Then we're going to talk about scripting in C# using Visual Studio. Then I'm going to teach you about all the cool features that Unity provides, like the input system, collisions and physics, as well as debugging and code analysis. Finally, I will teach you how to build Unity games and apps for over 25 different platforms.
What is Unity
So what is Unity exactly? Unity is a development platform for games and more. For example, anything that requires real time graphics can be done using Unity. For example 3D movies, simulations, and mixed reality experiences can be made using Unity.
Many of your favorite games are made with Unity. For example, the Ori series from Xbox Game Studios, as well as Wasteland 3, are made with Unity.
Unity uses .NET to enable C# scripting, and building for over 25 different platforms like iOS, Android, PC, Mac, Linux, game consoles, and MR headsets. Unity comes with a visual editor called the Unity editor as well as Visual Studio for your C# scripting needs.
To learn more about Unity, you can go directly to the Unity documentation.
Installing Unity
To install unity on both windows and Mac, you can head to unity's download page. Run the installer for the Unity Hub. The Unity hub allows us to manage different Unity versions. You should create an account with Unity first so you can activate a license.
After running the Unity Hub and activating a free license, for the first time. You will notice that you have no unity versions installed when pressing on the installations tab on the left. You can change that by pressing on Add to install a version of Unity.
We recommend installing the long-term support (LTS) versions for more stability, and as the name says, long-term support from Unity.
If you don't have Visual Studio installed, you have the option of installing Visual Studio as part of the installation process here. You can also choose which platforms you want to support. Agree to the terms and conditions and start installing. If you installed Visual Studio separately on windows, make sure you install the unity support from the Visual Studio installer. Visual Studio for Mac is already bundled with support for unity.
After unity installs. You can start your project. Go to project tab in the Unity Hub, then click on the new button.
Choose 3D, if you want to create a 3D game, then give it a name. Select create when done.
Unity will create your project and you should see Unity’s editor on screen. You are now ready to use Unity.
Creating scenes
On the left, in the scene hierarchy, you will see that Unity already opened up a Scene for you and added a camera to it. You can think of a scene as a film set, or a game level. You can create multiple scenes and save them separately. To create a new scene, just right click anywhere on the project tab at the bottom then select Create -> Scene.
Adding objects to scenes
To add a game object to the scene, right click anywhere on the hierarchy tab. You can see a list of all the types of objects you can add to a scene. Every one of these objects inherit from a base call called GameObject. Choose an object to add, then select it from the scene hierarchy. Look at the inspector window, you can see all the variables and all the components that make up this gameObject. You can think of each one of these components as a C# script with its own class that inherits from MonoBehavior.
Creating C# scripts
To create your first C# script, right click anywhere in the Project tab, then choose to create -> C# script. You can drag and drop the script you created on a GameObject in the hierarchy tab, or in the inspector tab to add it to that GameObject. You can also add it by selecting the Add Component located at the bottom of the inspector tab.
Double clicking on the script will open up Visual Studio so that you can start editing the script. Once Visual Studio loads up, it should also activate the Unity specific features. A good way to know that Visual Studio has activated is to see the “Attach to Unity” at the top of the IDE.
Unity should have already created a class for you that inherent from MonoBehavior, ready for you to modify. I will discus MonoBehaviours in my next post.
Please check our full video covering this topic in our video beginner series for Unity.