Plugin for Unity: Install and set up plugin components - Amazon GameLift

Plugin for Unity: Install and set up plugin components

This section describes how to add the plugin to a Unity project. After the plugin is installed, plugin functionality is available when you have the project open in the Unity editor.

Before you start

Here’s what you need to use the Amazon GameLift plugin for Unity:

  • Unity for Windows 2022 LTS or Unity for MacOS

  • Amazon GameLift plugin for Unity download. [Download site] The download includes two packages:

    • Amazon GameLift standalone plugin for Unity

    • Amazon GameLift C# server SDK for Unity

  • Microsoft Visual Studio 2019 or newer.

  • A multiplayer game project with C# game code.

  • The third party scoped registry UnityNuGet. This tool manages third-party DLLs. For more information, see the UnityNuGet Github repository.

Add the plugin to your game project

Complete the following tasks, working in the Unity editor and your game project files.

Step 1: Add UnityNuGet to your game project

If you don't have UnityNuGet set up for your game project, use the following steps to install the tool using the Unity package manager. Alternatively, you can use the NuGet CLI to manually download the DLLs. For more information, see the Amazon GameLift C# server SDK for Unity README.

  1. With your project open in the Unity editor, go to the main menu and select Edit, Project Settings. From the options, choose the Package Manager section and open the Scoped Registries group.

  2. Choose the + button and enter the following values for the UnityNuGet scoped registry:

    Name: Unity NuGet URL: https://unitynuget-registry.azurewebsites.net Scope(s): org.nuget

For Unity 2021 version users:

After setting up UnityNuGet, check for Assembly Version Validation errors showing in the Unity console. These errors occur if binding redirects for strongly named assemblies in the NuGet packages are not resolving correctly to paths within your Unity project. To resolve this issue, configure Unity's assembly version validation:

  1. In the Unity editor, go to the main menu and select Edit, Project Settings, and open the Player section.

  2. Deselect the Assembly Version Validation option.

Step 2: Add the plugin and C# server SDK packages

  1. Unzip the Amazon GameLift plugin for Unity download, which contains both packages.

  2. With your project open in the Unity Editor, go to the main menu and select Window, Package Manager.

  3. Choose the + button to add a new package. Choose the option Add package from tarball.

  4. In Select packages on disk, locate the Amazon GameLift C# Server SDK plugin for Unity download files, and choose the com.amazonaws.gameliftserver.sdk-<version>.tgz file. Choose Open to install the plugin.

  5. In Select packages on disk, locate the Amazon GameLift standalone plugin for Unity download files, and choose the file com.amazonaws.gamelift-<version>.tgz. Choose Open to install the plugin.

  6. Verify that the standalone plugin is added to your project. Return to the Unity editor window. Check the main menu for the new Amazon GameLift menu button.

Step 3: Import the sample game (optional)

The plugin for Unity comes with a set of sample game assets, including scenes, that you can add to your game project. Importing the sample game gives you a fast path to testing, building, and deploying a simple multiplayer game with Amazon GameLift. The sample game is already fully integrated with Amazon GameLift SDKs, so you can skip the integration tasks and complete the remaining workflow tasks.

When using the sample game, you can set up and join a locally hosted Amazon GameLift Anywhere fleet in just a few minutes. You can deploy the game to Amazon GameLift and join a live, cloud-hosted game in under an hour.

To import the sample game:
  1. With your game project open in the Unity Editor, go to the Amazon GameLift menu and select Sample Game, Import Sample Game.

  2. After the files are imported, go to the Amazon GameLift menu again and select Sample Game, Initialize Settings. This step configures your project for building the game client and server.

When installation is complete, you’ll see two new scenes added to your game project. You’ll also see some additional project assets, including a GameLiftClientSettings asset.

For more details on the sample’s UI and gameplay, see the sample game readme.