# Install Unity and the project

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/)
- [Machine Learning in games](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/02-ml-in-games/)
- [Install Unity and the project](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/03-install/)
- [The Dr Arm game](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/04-the-dr-arm-game/)
- [Machine Learning in Unity](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/05-machine-learning-in-unity/)
- [The Unity project](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/06-the-unity-project/)
- [Objects and Components](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/07-objects-and-components/)
- [Training our ML agents](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/08-training-our-ml-agents/)
- [Optimizations](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/09-optimizations/)
- [Summary](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/10-summary/)
- [Next Steps](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/_next-steps/)

## Getting started
The Unity ML Agents toolkit provides a C# API for use in your project and Python scripts to run outside of Unity. You will need Python itself and a few extra libraries.

You will need the Python tools before the training stage, but to get started quickly just install Unity to begin.

## Tools
Install Unity via the Unity Hub. The Unity Hub provides an easy way to manage multiple installations of Unity. It also provides a straightforward way of adding the required support modules. You will need the following:

- Unity Hub
- Unity
- Visual Studio Community Edition (Unity support module)
- Dr Arm Unity project files (the accompanying zip file)
- [*only for deploying to an Android device*] Android build support (Unity support module)

The installation instructions in the next section go through the steps shown above, starting with the Unity Hub.

## Installing Unity Hub, Unity and support modules
1. Download and install the [Unity Hub](https://unity3d.com/get-unity/download?ref=personal)  
   Note that Personal licenses are free, and if running on Windows you will need Windows 10 or 11 and a GPU with DirectX 10 capabilities. If running Unity on a Mac or Linux, please follow the instructions for your platform.
2. In Unity Hub, download and install Unity. The latest LTS (Long Term Support) release should work but this project has been tested on 2022.3.12f1.
   1. In Unity Hub go to **Installs** and click **Install Editor**
   2. Go to the *Archive* page and find version 2022.3.12f1. Select the “Unity Hub” download button rather than downloading the Unity Editor directly
   3. The install will require several gigabytes (including Android deployment options) so check your available disk space first
3. Add Android Build support
   1. Click the *Settings* icon and choose *Add Modules*
   
   ![Image Alt Text:Unity Hub Installs](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/images/unityhubinstalls.png)  
   _Figure 1. List of Unity versions installed_
   
   2. Under **Dev Tools**, choose *Microsoft Visual Studio Community 2022* if you wish to install it. This integrates well with Unity as a code editor, but any editor will do for editing scripts
   3. Under **Platforms**, choose *Android Build Support*. Also make sure to choose *OpenJDK* and *Android SDK & NDK Tools* as well
   
   ![Image Alt Text:Unity Hub Add Modules](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/images/unity-hub-add-modules.png)  
   _Figure 2. Tick the modules you want installed_
   
   4. Press *Continue*, and then agree to the Android SDK and NDK License Terms to install everything
   5. If you prefer to use an alternative script editor, you might want to check your editor is active; see section below *Check active script editor in Unity*

## Download and open the Dr Arm Unity project
1. Download and extract the accompanying Unity project from the [supporting zip file](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/files/MLAgentsWorkshopSupportingFiles.zip).
2. Open Unity Hub
3. From the Unity Hub, under the Projects tab, click the down-arrow next to Open and select “Add project from disk”.
4. Choose the location of your workshop files (the directory that contains the *Assets* folder)
5. The project will appear in the list. Click it to open the project in Unity.
6. It may take a few minutes for Unity to process the asset files.

## Check active script editor in Unity
Depending on your setup, it’s possible that the default script editor is not set to your preferred editor:
1. In Unity select *Edit* menu and then *Preferences*
2. In the *Preferences* window, select *External Tools* on the left
3. Select your desired editor from the drop-down menu next to *External Script Editor*
   
   ![Image Alt Text:External script editor window](https://learn.arm.com/learning-paths/mobile-graphics-and-gaming/using_unity_machine_learning_agents/images/unity-external-script-editor.jpg)  
   _Figure 3. External tool options in Unity_
