Compatible with Unity 2021.3 LTS and 2022.3 LTS.
Amazon GameLift is a fully managed service that lets game developers to manage and scale dedicated game servers for session-based multiplayer games. The Amazon GameLift plugin for Unity provides tools that makes it quicker and easier to set up your Unity project for hosting on Amazon GameLift. Once the plugin is installed, you can access the plugin from within the Unity editor and start using it to integrate Amazon GameLift functionality into your client and server code. The plugin contains functionality to automatically bootstrap your game runtime environment to the AWS Cloud, fully test your game server integration with Amazon GameLift locally, and deploy your game servers on Amazon GameLift. For more information about using the plugin for Unity, see the Amazon GameLift plugin for Unity guide.
You can use built-in templates to deploy your game for the following common scenarios.
- Single-region fleet: Deploy your game server to one fleet in a single AWS Region. Use this scenario to experiment with your install scripts and runtime deployment, as well as your integration.
- FlexMatch fleet: Deploy your game server for hosting with a FlexMatch matchmaking solution. Amazon GameLift FlexMatch is a highly scalable and customizable matchmaking service for multiplayer games. Use this scenario to set up basic matchmaking components (including a rule set) that you can customize.
Each scenario uses an AWS CloudFormation template to deploy a resource stack for your game server solution. You can view and manage your resource stacks in the AWS Management Console for CloudFormation.
- Amazon GameLift plugin for Unity download package. Download a zip file from the GitHub Releases page. Or clone the plugin from the Github repo.
- A compatible Unity editor (2021.3 LTS, 2022.3 LTS) with Dedicated Server Build Support module for Windows (and Linux if desired).
- (Optional) A C# multiplayer game project with game code.
- An AWS account with access permissions to use Amazon GameLift, Amazon S3, and AWS CloudFormation. See Set up programmatic access with long-term credentials.
Complete the following steps to install and enable the plugin for your multiplayer game project. For more details, see the Amazon GameLift documentation.
-
Install the Amazon GameLift Plugin for Unity.
- Find the
com.amazonaws.gamelift-<version>.tgz
file within the downloaded release zip or follow the contribution guide to build the tarball yourself. - In your Unity project, open
Window > Package Manager
. - Click
+ > Add package from tarball...
and select the above tarball.
- Find the
-
Install the Amazon GameLift C# Server SDK for Unity plugin (aka. lightweight Unity plugin).
- Find and unzip the
GameLift-CSharp-ServerSDK-UnityPlugin-<version>.zip
file within the downloaded release zip or download it from Amazon GameLift's Getting Started. - In your Unity project, open
Edit > Project Settings > Package Manager
. - Under
Scoped Registries
, click on the+
button and enter the values for the UnityNuGet scoped registry:Name: Unity NuGet Url: https://unitynuget-registry.azurewebsites.net Scope(s): org.nuget
- In your Unity project, open
Window > Package Manager
. - Click
+ > Add package from tarball...
and select the tarball within the unzipped folder,com.amazonaws.gameliftserver.sdk-<version>.tgz
.
- Find and unzip the
-
(Optional) Import the sample project and configure the build settings.
- In your Unity project, select
Amazon GameLift > Sample Game > Import Sample Game
and import all assets. - In your Unity project, select
Amazon GameLift > Sample Game > Initialize Settings
.
- In your Unity project, select
- Administrator rights on a Microsoft Windows OS
- A supported Unity version
- You also need to add the Unity editor folder (e.g.
C:\Program Files\Unity\Hub\Editor\<version>\Editor\
) to the Windows PATH environment variable.
- You also need to add the Unity editor folder (e.g.
- AWS CLI 2.x
- Ensure the AWS CLI is in the Windows PATH environment. This should be handled by the installation wizard. A restart may be required after installation is complete.
- Visual Studio 2019 (can be installed with Unity) or Jetbrains Rider 2024
- .NET Core 6 to build the core plugin source.
- NodeJS/npm: https://nodejs.org/en/download/ to package the plugin.
- Clone the
amazon-gamelift-plugin-unity
repository from GitHub. - Run
Scripts~\windows\release.ps1 -Sdk <version>
in PowerShell to build the plugin and dependent libraries (only needed once). - In Unity Hub, create a new project.
- Open Unity Package Manager, import project from disk, and select the
package.json
located in the plugin's root folder. - Setup code debugging in Unity: https://docs.unity3d.com/Manual/ManagedCodeDebugging.html, and change Unity project to Debug Mode.
- A .sln file should be created in the Unity project root, you can open that with Visual Studio.
- Make changes to the plugin code, and Unity should recompile after each change.
- Once changes are made, run the unit tests via
Window > General > Test Runner
.
Run Scripts~\windows\release.ps1 -Sdk <version>
to clean, build, export, and package the plugin with the server SDK in a single command.
Alternatively:
- Run
Scripts~\windows\clean.ps1
to delete all dlls and temp files (If you want to build faster, you can comment out.clean-download-files
execution). - Run
Scripts~\windows\build.ps1
to build dlls and sample game. - Run
Scripts~\windows\export.ps1 -Sdk <version>
to export the plugin into a tarball (.tgz) and package it with the server SDK in the project root folder.
Follow instructions in Unity Docs to enable your project for testing:
- Open the Project manifest (located at
<project>/Packages/manifest.json
). - Verify
com.amazonaws.gamelift
is present as a dependency. - Add to the bottom of the file:
"testables": [ "com.amazonaws.gamelift" ]
After enabling testing, the project tests can be run via Unity Test Runner.
The Amazon GameLift Plug-in for Unity is compatible only with officially supported versions of Unity 2021.3 LTS and 2022.3 LTS for Windows and Mac OS.
An additional error log file related to the Unity game project can be found in the following location: logs/amazon-gamelift-plugin-logs[YYYYMMDD].txt
. Note that the log file is created once a day.