Game development: Getting started guide with Unity
At multiple occasions, I encounter developers who want to get started with game development. As is the case, a lot of them love Unity when I tell them about it. So, here’s a getting started guide for anyone looking to get started with Unity.
Get to know the Unity IDE:
This is the environment you will work mostly in. Spend some time getting to know it better.
Here, you can see the Scene view, Game view, Hierarchy, Project, Inspector and other toolbars. You can change the current layout of these multiple windows by choosing from the Layout dropdown at the top right. Unity has given a good short description of each of these in their official video. Head over here. Remember, everything in Unity will be built in multiple scenes. A Scene file is akin to a unique level in your game. Head over here to learn more. Here I have 2 scenes – 001 and 002.
Some terminology in Unity:
Learn these terms to get started – GameObjects and Components, Prefabs, Textures , Sprites, Layers.
Adding Physics to objects is easy:
Unity has 3D and 2D physics and animation systems built into it - which means adding physics and animations to objects is easy. Usually, you will use 2 Physics components on your character/environment:
(i) something which gives mass and allows objects to be under influence of gravity (RigidBody/RigidBody2D) – and if you’re giving a body mass, you would want it to interact with the environment, or want it to walk on the surface – hence, you need the body and the environment to interact with each other through a collision (even if you just want a character to walk on a floor, you need to ensure that the character and the floor are colliding with each other) . This collider is the 2nd part
(ii) A collider which tells Unity the region to detect collisions (for example, a Box collider 2D)
For collisions that shouldn’t use physics engine, like picking up a coin – you can use something called isTrigger in the Unity IDE to mark it that way.
Changes made to a game view do NOT persist:
This is something that new game developers on Unity need to remember very well. Usually, we make changes when the game is in Play mode (when you click the Play sign). However, any change made to the Scene view in Play mode will not persist once you stop the game – hence, all the changes will be lost. Stop the game, make the changes to the scene and you’re good to go. I’ve seen some developers who change the color of the Unity editor background to a complete contrast when the game is in play mode, just so that they know that they are NOT supposed to make the changes to the Scene at that time.
Build for multiple platforms using Unity:
This is the utility of using Unity – you can target multiple platforms like iOS, Android, Windows 10 devices, Virtual Reality and Augmented Reality platforms like Microsoft Hololens and Oculus VR, Console gaming platforms like Xbox One and PS4, Smart TV and WebGL.
Use the Asset store:
It’s a store consisting of a lot of free and commercial assets that you can use in your Unity project, which have been built by the Unity team and the community around Unity. You can find and download textures, animations, project examples, etc on the store. You can access the Asset store from within Unity by going to Windows -> Asset Store. It will ask you to create a free user account on your first visit.
Use these resources to learn on Unity:
If you’re starting with Unity, it may seem to be a lot to digest on your first visit. However, there are excellent resources to learn more, supported by an active community, which can help you in building your first game:
o Unity official documentation is an excellent source to learn features of Unity. They have short videos to explain particular concepts of Unity. Head over here: https://unity3d.com/learn
o Free course on Unity: https://mva.microsoft.com/training-courses/developing-2d-3d-games-with-unity-for-windows-jump-start (Especially Module 2 - where you can build your first 2D game. Scripts and assets for this module are here: https://github.com/TobiahZ/10th-Planet)
o https://channel9.msdn.com/coding4fun/blog/Learning-Unity-3D
o https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Build-A-Unity-Game-Part-1
o Courses on Pluralsight like this: https://www.pluralsight.com/courses/introduction-game-development-unity (requires Pluralsight subscription)
Have fun building games!
Until next time,
Saurabh Kirtani