How I teach my cat Unity development or something like that: Project Setup (Part 1)
2D Game Development
Unity Project Setup (Part 1 of 2)
*****************************************************************
Hi there. This is the second tech episode of “How I teach my cat Unity development or something like that”.
We will begin our game development journey by developing our first 2D game prototype with Unity.
Just for fun, I did a mock screenshot of a Space Invaders inspired game featuring Mio as the alien mothership and two combined water guns as our player avatar. Of course, this is not the final product as we will be developing the game by using assets from GameDevHQ library that are specifically tailored for this 2D game.
There will be a lot of components that we need to go through in this 2D game development, hence they will be covered in several journal entries.
To begin, let’s start with the first section which is on Unity Project Setup. Here is the layout of the section for easy access.
Unity Project Setup (Part 1 of 2) - Table of Contents
- What is Unity
- Downloading Unity Hub
- Installing Unity Hub
- Downloading and installing the latest version of Unity
- Getting Started with Unity #1 - Creating a new Unity project
- Getting Started with Unity #2 - Creating a new Git project repository at GitHub
- Getting Started with Unity #3 - Linking Unity project folder to new Git project repo at GitHub
- Getting Started with Unity #4 - Exploring the Unity Interface
- References
*****************************************************************
What is Unity?
Unity is 2D/3D game engine that developers can use to develop games on the console, mobile and PC. As a game engine which uses C# language, it offers an IDE and important built-in features (physics, 3D rendering, collision detection) that makes it easy for developers to work.
An IDE (“integrated development environment to potential developers”) is an interface that gives developer’s access to all the tools they need for development in one place. Furthermore, Unity has a visual editor that allows developers to simply drag and drop elements into scenes (also known as levels) and then manipulate their properties. Unity runs on C#.
Apart from games, Unity can also be used in developing other applications such as 3D modeling & visualizations, Virtual Reality (VR) experience, Home/Architectural Design, Business, Marketing etc.
*****************************************************************
Download Unity Hub
- To begin, let’s head directly to Unity Store’s download page at https://store.unity.com/download
- Accept the Terms of Service and click ‘Download Unity Hub’
*****************************************************************
Installing Unity Hub
Once downloaded, proceed to open the installer software and breeze through the default settings and hit Install.
Unity Hub is a stand alone management tool that you can use to install/uninstall your Unity installations (versions) and allows you to create new Projects and open existing ones.
*****************************************************************
Downloading and installing the latest version of Unity
- Open Unity Hub
2. Click on the Installs’ tab on the left panel and click the blue Add button on the top right hand side.
3. A pop up window will appear -Add Unity Version.
In the section, “1. Select a version of Unity”, select the Recommended Release or the latest release and hit Next
4. Under the “2. Add modules to your install”, put a check on the following items:
- Android Build Support: This would allow us to build and run for Android
- WebGL Build Support: This would allow us to deploy and render the game in a web browser without the need for additional tools or plug-ins as everything will be taken care by the HTML5/javascript program created by Unity.
- Windows Build Support (IL2CPP): This would allow us to build the game in IL2CPP (Intermediate Language To C++) which is an optimized compiler. The end result would be a native binary file (.exe, apk, .xap) that we can deploy for various platforms which will increase performance, security and platform compatibility for our Unity projects.
Afterwards, hit Next.
5. Check to accept the End User License Agreement and hit Done.
Wait for a few minutes while Unity Hub begins to download and install the selected release and modules.
Once installed, we can now to create a new project with Unity.
*****************************************************************
Getting Started with Unity - Create a new project
- While still in Unity Hub, click on the Projects tab and click the blue New button
2. In the “Create a new project with Unity” windows, select 3D under the Templates panel
Although the chosen template is 3D , we are still making a game in 2D. The trick is to manipulate the camera to give the sense of a 2D/2.5D perspective. More on this when we work with cameras.
3. Key in a Project Name * and Location * (folder name) . Afterwards, hit the Create button
Wait for a few seconds while Unity begins to load the newly created project.
Now that a new project setup is completed, let’s link the Unity project to GitHub.
*****************************************************************
Getting Started with Unity #2 - Creating a new Git project repository at GitHub
In episode 2 on VERSION CONTROL & GIT, we have already discussed the steps to create a new repository/project in GitHub. For a re-cap, here are the steps again:
- Go to GitHub site at https://github.com.
- Click the “Create repository” on the left panel or inside the dropdown menu under the “+” sign symbol at the top right hand corner of the page.
2. Fill in the details under the Create new repository window for Repository name * and Description (optional). Don’t forget to toggle ON Public and to select Unity from the drop down list under Add .gitignore.
Optional: I checked the “Add a README file” so that anyone who opens our repository will get to read some useful information (manual) about the project.
Afterwards, hit Create repository
Optional: I checked on the “Add a README file” so that anyone who opens my repository will get to read some useful information (manual) about my project.
3. Once redirected to the new repository page, copy the GitHub repository URL path after accessing the green Code button
*****************************************************************
Getting Started with Unity #3 - Linking Unity project folder to new Git project repo at GitHub
1. Open Windows/File Explorer and make our way to the Unity project folder
2. Then right click on any area within the folder and select “Git Bash here” from the dropdown menu
3. To create a new local Git repository, run
git init
4. To establish a connection with the new repository at GitHub, run
git remote add origin https://github.com/surayaakmalalipiah/MIO-A-2D-Space-Opera-Odyssey.git
5. To verify the connection, run
git remote -v
We now have a successful link from our local Git repository to our remote Git repository at GitHub. Now that the project setup is completed, let’s explore the Unity interface.
Getting Started with Unity #4 - Exploring the Unity Interface
- Launch the new project in Unity and we should be presented with the following Unity interface and layout (default)
- Toolbar: On it’s left hand side, it has some basic tools that we can use to manipulate the game object (objects such as characters, props, camera, lights, scenery) and the Scene/level. In its centre, are the play, pause and step controls buttons. And on the right hand side, are some Unity service related stuff, followed by the layer visibility menu and the layout editor.
- Hierarchy window: Show a representation of every game object in the level or scene as well as how they are structurally connected/attached, all in hierarchical form.
- Inspector Window: All the game objects in the scene have properties. When we select a game object, the Inspector allows us to view and edit all of its properties (the currently selected game object)
- Project window: In our project, we can use an Asset which is an item (such as a 3D model, texture/image file, audio) that we created outside of Unity and is supported by Unity. Once we import an Asset into our project, it will be displayed here.
- Status Bar: It is a horizontal window located at the bottom of the Unity interface that displays various kinds of status information and notifications about Unity processes and also has quick access to related tools and settings.
- Scene view: This a windows that allows us to visually navigate and edit our scene or level either in 3D or 2D perspective.
- Game view: What you see is what you get… when seen through the our camera. Hence, it simulates what our final rendered product will look like from the perspective of the Scene camera.
For an in-depth description on the Unity’s user interface, check the manual at https://docs.unity3d.com/Manual/UsingTheEditor.html
****************************************************************
Let’s stop here for now. There is one more section on the user interface that we will cover in the next entry. Once that is done, we can begin to work on our game…yay finally!
[To be Continued]