# Unity Primer

## Installing Unity

{% embed url="<https://store.unity.com/download?ref=personal>" %}

1. Head to [unity3d.com](https://www.unity3d.com) and download the **relevant instance** of Unity.
2. Make sure you install the **necessary components,** particularly **Vuforia Augmented Reality Support** and the relevant packages for any particular platform you wish to develop for.

![Figure 1.0 - Make sure to install Vuforia Unity Components](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYZK9y8Wl8jdT2P34mj%2F-LYZLtmO4JVhUm9rA5uh%2FScreen%20Shot%202019-02-13%20at%2011.54.15%20am.png?alt=media\&token=d3b6e754-9eb4-4bb3-bd8a-2a7d6a8bdc61)

## Creating a Project

To create a new **Unity Project**, open **Unity** and select create a **New Local Project**. `Projects > On Disk > New Project`

![Figure 2.0 - Creating a new Unity Project](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYZpUMmRqEZgRZi00Pt%2F-LYZswhZIZ49fYA4xze9%2FScreen%20Shot%202019-02-13%20at%202.11.57%20pm.png?alt=media\&token=883a9012-c572-45f0-9b38-b0cac07e8d28)

**Asset Packages** can be added during this step based on the existing asset packages that have been previously downloaded.

![Figure 2.1 - Project Naming and Asset Packages](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYZpUMmRqEZgRZi00Pt%2F-LYZtb7o_FHECqqMd_1z%2FScreen%20Shot%202019-02-13%20at%202.12.46%20pm.png?alt=media\&token=0d20250b-4100-437d-a146-7a62d55f0a7b)

## User Interface

Once a project has been created, the main **Unity Interface** will be displayed.

The **Unity Interface** is comprised of **five main elements** shown below in Figure 3.0:

1. Toolbar
2. Hierarchy Window
3. Inspector Window
4. Project Window
5. Scene View

![Figure 3.0 - Unity Interface (UnityDocs)](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYURpq5MJM_XMFWyPqZ%2F-LYUdItPZK8tomYxunrQ%2Fimage.png?alt=media\&token=eb8d0f6d-6ed0-4d4c-b06e-dbf592906a42)

### The Toolbar

The **Toolbar** contains Unity's most important working features.&#x20;

![Figure 3.1 - The Unity Toolbar](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYURpq5MJM_XMFWyPqZ%2F-LYUeiSGneW1X5cf0fqo%2FToolBar.png?alt=media\&token=6b6cd2ee-b00c-4c7f-bdb0-c42c8c72365c)

* The **icons on the left** are used for **manipulating** both objects and t**he scene view**.&#x20;
* The **central controls** are used for **debugging** (playing) your scene.
* Similar to Adobe Cloud, the **right-hand dropdown menus** provide access to **different window layouts** or configurations and l**ayer visibility settings**.

### The Hierarchy Window

The **Hierarchy Window** lists all objects currently in the scene, and is used to show which objects are dependent upon others.

![Figure 3.2 - The Unity Hierarchy Window](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYURpq5MJM_XMFWyPqZ%2F-LYUeecd97G3DxaQtkRd%2FHierarchy.png?alt=media\&token=8bcacbd5-b768-4c66-a3c8-d7e366c0b01a)

### The Inspector Window

The **Inspector Window** is located on the right of your screen and is generally used to display the properties of a selected object.

![Figure 3.3 - The Unity Inspector Window (Unity Docs)](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYUgGVg7HeJFmizovOL%2F-LYUgtp6kIte7TwX9XIl%2Fimage.png?alt=media\&token=b666b52f-2d49-4455-ba73-eb76147b6429)

![Figure 3.3.1 - The Unity Inspector Window's Other Functions](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYURpq5MJM_XMFWyPqZ%2F-LYUeat7zLCE45A6dtsE%2FScreen%20Shot%202019-02-12%20at%202.03.57%20pm.png?alt=media\&token=e92acfc5-5717-4f69-8352-8563715d777b)

In Figure 3.3, the inspector functions as a properties pane, with the ability to **perform transformations** on and **alter the properties** of particular **objects**, but usually this window can also also serve other functions. In Figure 3.3.1 the Unity Inspector **Window** serves as a **Tutorial Guide**.

### The Project Window

The **Project Window** is located at the **bottom** of the screen. It is generally used to display the **asset library** which are within a **project folder**.

![Figure 3.4 - The Unity Project Window](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYURpq5MJM_XMFWyPqZ%2F-LYUeat6djM2gUvhY5Ub%2FScreen%20Shot%202019-02-12%20at%202.03.16%20pm.png?alt=media\&token=6f316ba3-7391-44ba-b459-e1d422330554)

**Assets** should first be **loaded in to this project window prior to being dropped in to a scene**, so that the application is self-contained.

### The Scene View Window

The **Scene View Window** is a **representation of your scene**, and is located in the center of your display. The scene can be manipulated using the controls in the **top-right** of the **toolbar**.

![Figure 3.5 - The Unity Scene Window](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYURpq5MJM_XMFWyPqZ%2F-LYUeat4o3Y9JHcF62n0%2FScreen%20Shot%202019-02-12%20at%201.57.23%20pm.png?alt=media\&token=da62016d-8bcb-4fdd-be16-bf9f3fdb8499)

The **scene view window** can be **either** a **2D** **or** **3D** rendering of a project, **depending on the type of project** being created.

## Understanding Unity Components

{% hint style="info" %}
This is a **Work in Progress Section** based on materials available on the [Unity Manual](https://docs.unity3d.com/Manual/).
{% endhint %}

### Scenes

Scenes contain the environments and menus of your game. Think of each unique **Scene** file as a unique level. In each **Scene**, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. Scenes can be created, saved and loaded like you would a file in the Project Window.&#x20;

#### Saving Scenes

Scenes need to be saved as well as Projects.&#x20;

To save the Scene you’re currently working on, choose **File** > **Save Scene** from the menu, or press Ctrl + S (Windows) or Cmd + S (masOS).

Unity saves Scenes as **Assets**\
&#x20;in your project’s *Assets* folder. This means they appear in the Project window, with the rest of your **Assets**.

### GameObjects

The **GameObject** is the most important concept in the Unity Editor.

Every object in your game is a **GameObject**, from characters and collectible items to lights, **cameras**\
&#x20;and special effects. However, a GameObject can’t do anything on its own; you need to give it properties before it can become a character, an environment, or a special effects by adding [components](https://docs.unity3d.com/Manual/Components.html)

A GameObject can contain any number of components. Unity has many built-in components, and you can create your own by writing C# scripts.

Depending on what kind of object you want to create, you add different combinations of components to a GameObject.

You can think of a GameObject as an empty cooking pot, and components as different ingredients that make up the recipe of your game. Unity has lots of different built-in component types, and you can also make your own components using the [Unity Scripting API](https://docs.unity3d.com/Manual/CreatingComponents.html).

This section explains how GameObjects, components and the Scripting API fit together, and how to create and use them.

### Assets

An asset is representation of any item that can be used in your game or project. An asset may come from a file created outside of Unity, such as a 3D model, an audio file, an image, or any of the other types of file that Unity supports. There are also some asset types that can be created within Unity, such as an **Animator Controller**, an Audio Mixer or a **Render Texture**\
.

![Some of the asset types that can be imported into Unity](https://docs.unity3d.com/uploads/Main/AssetWorkflowImportingFiles.png)

## Building Applications

{% hint style="info" %}
This is a **Work in Progress Section** based on materials available on the [Unity Manual](https://docs.unity3d.com/Manual/).
{% endhint %}

### iOS

{% embed url="<https://unity3d.com/learn/tutorials/topics/mobile-touch/building-your-unity-game-ios-device-testing?playlist=17138>" %}

### Android Devices

{% embed url="<https://unity3d.com/learn/tutorials/topics/mobile-touch/building-your-unity-game-android-device-testing?playlist=17138>" %}

### Microsoft HoloLens

{% embed url="<https://library.vuforia.com/content/vuforia-library/en/articles/Training/Developing-Vuforia-Apps-for-HoloLens.html>" %}

## Other Resources

{% embed url="<https://unity3d.com/learn/tutorials/>" %}

{% embed url="<https://docs.unity3d.com/Manual/>" %}
