Installing Amazon Web Services (AWS) for Unity?

Amazon provides the following instruction for installing AWS to Unity:

However, I am having trouble implementing them. I downloaded the zip files for the “AwsAssemblies” folder they suggest adding to your project base folder and extracted everything in it.

I then tried adding the code:

<ItemGroup>
  <Reference Include="AwsAssemblies\AWSSDK.Core.dll" />
  <Reference Include="AwsAssemblies\AWSSDK.S3.dll" />
</ItemGroup>

to my 4 .csproj files: Assembly-CSharp.csproj, Assembly-CSharp-firstpass.csproj, Assembly-CSharp-Editor.csproj, Assembly-CSharp-Editor-firstpass.csproj.

However, when I reopened my project it automatically erased these lines and they could no longer be found in any of those documents.

So I tried the other suggestion: Visual Studio > Project > Add Reference > Browse (at bottom) > ctrl+A in AswAssemblies > Okay. But these still don’t show up anywhere inside that Window after I do this.

So it seems I am stuck and unsure of what I am supposed to be doing.

They also suggest for I2CPP you need a link.xml file inside your Assets folder with the following code:

<linker>
    <assembly fullname="AWSSDK.Core" preserve="all"/>
    <assembly fullname="AWSSDK.DynamoDBv2" preserve="all"/>
    <assembly fullname="AWSSDK.Lambda" preserve="all"/>
</linker>

Is that the entire document? Ie. Just make a blank text file in Notepad, add that to it, and save as link.XML in Assets folder? I tried that but as far as I can see it’s not doing anything either.

I can’t find much on this anywhere. Any thoughts or suggestions are greatly appreciated.

Thanks.

Nothing you add to .csproj or .sln files will ever help you in Unity.

The reason: Unity wipes out and rewrites all that Visual Studio cruft whenever it feels you need it.

It has to be properly installed in Unity, such as by using the Unity Package Mangler.

Warning: the last I checked (and it was a few years ago), the AWS stuff was not even directly compatible with Unity. I seem to recall it even used a version of C# that Unity didn’t support, although that may have changed.

Definitely look for something that either installs in Unity as a Package (ideally), or perhaps is a shared library and/or code you install.

I would go search for you but a) you can search, and b) the AWS stuff was so horribly misorganized last time I looked that it was just a complete mess as to what version of the SDK was relevant. Almost everything that google suggested was incompatible with the Unity I used back then.

Thanks Kurt. I have searched, but AWS specifically states their products ARE compatible with Unity. For example:

https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/unity-special.html

I just can’t figure out how to make it work in part due to the issue you described where the csproj files are wiped out. They also don’t describe in enough detail for me to know what they want me to do with the linker code or the dlls.

Someone made a 3rd party AWS asset but only covering a few services in the Asset store. So I still need to figure out how to install this thing. Thanks again.

You need to place the dll files into the Assets folder. So make sure the AwsAssemblies folder is in your Assets folder. After this Unity should import the dlls and they can be used in scripts. No need to touch any csproj files as Unity will update them automatically based on all scripts and dlls in the Assets folder. Also I would suggest placing the link.xml into the AwsAssemblies folder as there can be multiple link.xml in a project and this would be specific to the AWS SDK.

Also bear in mind you don’t need to copy every dll from the zip to the AwsAssemblies folder. Only the parts you are going to use. Such as AWSSDK.S3.dll or AWSSDK.CognitoIdentity.dll. Then you need the common dependencies which are:
AWSSDK.Core.dll
Microsoft.Bcl.AsyncInterfaces.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Threading.Tasks.Extensions.dll

The link.xml should contain only the lines for AWSSDK.Core and the ones you use. E.g. if you used S3 and CognitoIdentity it would be:

<linker>
    <assembly fullname="AWSSDK.Core" preserve="all"/>
    <assembly fullname="AWSSDK.S3" preserve="all"/>
    <assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
</linker>
2 Likes