Setup

Install Unity

The next 3 chapters are a condensed summary of the Unity Essentials tutorials.

Unity Hub and Unity Editor

The Unity Hub is a standalone application that streamlines the way you navigate, download, and manage your Unity projects and installations. The Unity Editor is the application where you’ll build 3D or 2D worlds and create your interactive applications.

../_images/hub.png

Note

Usually, you start a code editor like Visual Studio and then you open your project files. Here, it is the opposite: from the Unity Hub, you open a project which then launches the editor.

License

The Unity Personal Plan is a free offering from Unity Technologies designed for individual developers, students, and small teams. Here is a list of current plans and pricing.

Install

  • Go to Unity Download page: https://unity.com/download

  • Choose: download for Windows (or Mac)

  • Launch the UnityHubSetup installer

  • Ask to install Unity V6 LTS

Then, run Unity Hub

  • Select the Installs section on the left. Then, left click on the gear to select Add modules

../_images/add.png

On the Add modules page, select the available options under DEV TOOLS:

  • On Windows, select Visual Studio

  • On Mac, select Visual Studio Code

Download Project

  • Download: Project Files

  • Decompress the zip files

  • Launch Unity Hub

    • Select the Projects section on the left

    • Click on the Add button and select Add project from disk

    • Select the main project folder, the one containing the assets, library and packages folders

../_images/addproject.png

Import project

Manage different versions

Project version and Unity version may be different. In such a case, you have two options :

  • You can try an automatic upgrade of the project to fit your current unity editor version. This option is sufficient for this tutorial

  • If the first option fails and you need to test this project, you’ll have to install the Unity version required by the project. This is undoubtedly the most reliable solution, but it involves performing a full installation of an older Unity version.

To install an older version of Unity

  • Go to Unity Hub > Installs

  • Click the « Install Editor » button.

    ../_images/installeditor.png

The project will appear in the list of available project in the Projects tab in Unity HUB.

Play mode

Run a project

  • At the bottom, in the Project Window, Navigate through: Assets > _Unity Essentials > Scenes.

  • Double-click on -1_Starter_Scene to open it:

../_images/ttt.png
  • Notice that you are in a work area where people edit scene and objects.

  • To run the game, click on the Play button at the top of the interface:

../_images/playbutton.png
  • Now in Play mode, you can test the game using WASD keys to walk around:

../_images/robot.gif

Play mode tint

To help you distinguish Play mode from the editor interface, it is possible to adapt Play mode background color.

  • From the main menu, select Edit > Preferences.

  • In the left menu, select Colors.

../_images/tint.png
  • Change Playmode tint color.

  • Enter Play mode to test the new tint:

../_images/tint2.png
  • Choose a color that is distinctive enough without reducing the legibility of the text.

Avertissement

It’s a tint, not a color: the tint color behaves like a plastic filter placed on top of the interface. So, choose a color close to white or this will darken the overall interface.

Dev Tools for Windows

Visual Studio

  • Install Visual Studio Community 2022 (not Visual Studio Code which is a lightweight version of VS2022).

  • If already installed, go to: Help > Check for updates.

  • In you Windows Launchbar, type: « Visual Studio installer » and run the package manager of Visual Studio 2022.

../_images/vsint.png
  • Click on Modify button.

  • Find and select: « Game Development with Unity »

../_images/vsunity.png
  • Then click on the Install/Modify button on the lower right.

    • Set VS Code as Unity’s default editor:

      • In Unity, go to Edit > Preferences | External Tools

      • Select Visual Studio Code as External Script Editor.

    ../_images/unity-externaltools.png

Unity

  • In Unity: open up Windows > Packages.

    • Set VS Code as Unity’s default editor:

      • In Unity, go to Edit > Preferences | External Tools

      • Select Visual Studio Code as External Script Editor.

    ../_images/vvv.png
    • Click on the button « Regenerate Project Files » to generate useful extra information for VS.

  • In Unity: open up Windows > Packages.

    • Make sure the Visual Studio Editor package is upgraded to 2.0.20 or above.

Check

Edit a script

  • At the bottom, in the Project Window, Navigate through: Assets > _Unity Essentials > Scripts > Provided Scripts.

../_images/scripttest.png
  • Double-click on « Collectible2D » to open the script in Visual automatically.

Project window

  • In Visual Studio, please check that the Project window has been populated:

../_images/vs.png

Intellisense

When starting to type, the editor should list different options:
  • List members functions

  • Parameter Info

  • Autocomplete Word

  • In the Update() function, type: « Debug. »

  • You should see intellisense hint:

../_images/intelli.png

Avertissement

If project window and intellisense do not work correctly, please ask for help because the pipeline between Unity and VS is not working correctly.

Dev Tools for MAC

Note

Visual Studio 2022 is no more available for Mac. You have to use VS Code instead, which is also a great code assistant but it does not offer Debug functionalities.

VScode

  • Install Visual Studio code (VS Code)

    • If already installed please check for update: Help > check for update

  • Install the Unity for VS Code extension from the Visual Studio Marketplace.

    • Run Visual Studio Code

    • Click on the Extensions Manager Button on the left:

    ../_images/extension.png
    • Write « Unity » in the search bar and click on the « install » button.

    ../_images/unityext.png

Unity

  • In Unity: open up Windows > Packages.

    • Make sure the Visual Studio Editor package is upgraded to 2.0.20 or above.

../_images/vscodemanager.png
  • Set VS Code as Unity’s default editor:

    • In Unity, go to Edit > Preferences | External Tools

    • Select Visual Studio Code as External Script Editor.

../_images/unity-externaltools.png

When you edit script, you have quick info when you move your cursor on Unity’s object:

../_images/codehelp.png

Desktop Manager (Win)

–optional–

In order to keep your desktop organized, consider setting up a desktop manager. This way you can:

  • Have one background image per virtual desktop

  • Organize your icons differently on each desktop

  • Share all your apps between different desktops

This year, we test: Dexpot

  • After installation, you can find a small icon in the system tray (in the lower right, near the windows clock).

  • Right click on this icon to open configuration menu:

    ../_images/dex1.png
  • Select Settings > General

    • Select the number of desktops you want (3 or 4 may be sufficient)

    • Select

      • Start with Windows

      • Hide splash screen

    ../_images/dexpot1.png
  • Select Settings > General

    • Select Customize Desktop Icons

    • Select Customize Desktop Background

    ../_images/dex2.png
    • Click on the button : « Advanced »

      • Select : « Create a separate folder for each desktop »

      • Select : « Use original desktop folder for desktop 1 »

      ../_images/dex3.png
      • This way, if you decide to remove this app, desktop 1 will remain the main desktop.

Now the desktop manager is working. You can configure different backgrounds if you want:

  • Select Configure desktops

    ../_images/dex4.png

To change desktop, just use : ALT+1, ALT+2