Download the AWS .NET SDK

To be able to do direct ingestion to Kinesis using the AWS SDK, we need to download the AWS SDK for .NET.

There are two ways to get the required AWS SDKs in order to start developing on AWS in Unity. You can either grab the NuGet packages in Visual Studio, or from the AWS owned GitHub repository of SDKs. The easiest method is to use Visual Studio Community, which is provided with the latest versions of Unity Pro.

  • Open Visual Studio, select Project and choose Manage NuGet Packages. If instead you would like to grab our SDKS from GitHub, click here to visit our SDK GitHub repository

  • Search for the AWSSDK.Core, AWSSDK.Kinesis, AWSSDK.CognitoIdentity packages and add them to your project

  • This workshop also uses the Newtonsoft.Json package to serialize dictionaries to JSON when sending data to Kinesis Data Streams, so you will need to add this to your project as well. When you download these packages using NuGet, they will download to your packages folder in your Unity project.

  • In Unity’s Player Settings, you will need to target API Compatibility Level .NET 4.X as pictured below. To do this, select EditProject SettingsPlayerAPI Compatibility Level and choose .NET 4.X

For more information about Unity’s scripting runtime and using .NET 4.X versus .NET Standard 2.0, visit the documentation for Unity’s .Net Profile support and Scripting restrictions.

  • Once your .dlls are copied they should be moved to the Plugins folder in the Unity project. If this is a new project and you do not see your Plugins folder, create one inside of the Assets folder.

  • You should also create a link.xml file to minimize dependency issues between NuGet and Unity projects when building and deploying to device. Find out more about link.xml files here. To do this, in your assets folder create a link.xml file with the following code:

This prevents Unity from stripping required data from the libraries when building. Some platforms, like iOS, even require a link.xml file to work on the device. The System.Linq line helps with IL2CPP platforms, like iOS, to avoid incompatibilities with NewtonSoft, the library we will be using to serialize dictionaries to JSON. Click here for more information about link.xml files, .NET 4.x, and .NET Standard 2.0 requirements.

For more detailed information on integrating AWS and Unity using the SDKs, check out this blog post - “Generate custom game events from Unity integrated with the Game Analytics Pipeline”