<type fullname="UnityEngine.Networking.UploadHandler" preserve="all" />
<type fullname="UnityEngine.Networking.DownloadHandler" preserve="all" />
<type fullname="UnityEngine.Networking.DownloadHandlerBuffer" preserve="all" />
</assembly>
<assembly fullname="mscorlib">
<namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>
<assembly fullname="System">
<namespace fullname="System.Security.Cryptography" preserve="all"/>
</assembly>
<assembly fullname="AWSSDK.Core" preserve="all"/>
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all"/>
<assembly fullname="AWSSDK.SecurityToken" preserve="all"/>
add more services that you need here...
</linker>
Step 3: Obtain the Identity Pool ID using Amazon Cognito
To use AWS services in your mobile application, you must obtain the Identity Pool ID using Amazon Cognito Identity. Using Amazon Cognito to obtain the Identity Pool ID allows your app to access AWS services without having to embed your private credentials in your application. This also allows you to set permissions to control which AWS services your users have access to.
To get started with Amazon Cognito, you must create an identity pool. An identity pool is a store of user identity data specific to your account. Every identity pool has configurable IAM roles that allow you to specify which AWS services your application’s users can access. Typically, a developer will use one identity pool per application. For more information on identity pools, see the Amazon Cognito Developer Guide.
To create an identity pool for your application:
1. Log in to the Amazon Cognito Console and click Create new identity pool.
2. Enter a name for your Identity Pool and check the checkbox to enable access to unauthenticated identities. Click Create Pool to create your identity pool.
3. Click Allow to create the two default roles associated with your identity pool–one for unauthenticated users and one for authenticated users. These default roles provide your identity pool access to Cognito Sync and Mobile Analytics.
The next page displays code that creates a credentials provider so you can easily integrate Cognito Identity with your Unity application. You pass the credentials provider object to the constructor of the AWS client you are using. The code looks like this:
CognitoAWSCredentials credentials = new CognitoAWSCredentials ( "IDENTITY_POOL_ID", // Identity Pool ID
RegionEndpoint.USEast1 // Region );
Next Steps
• Get Started: Read Getting Started with the AWS Mobile SDK for Unity (p. 7) to get a more detailed overview of the services included in the SDK.
Next Steps
• Run the demos: View our sample Unity applications that demonstrate common use cases. To run the sample apps, set up the SDK for Unity as described above, and then follow the instructions contained in the README files of the individual samples.
• Read the API Reference: View the API Reference for the AWS Mobile SDK for Unity.
• Ask questions: Post questions on the AWS Mobile SDK Forums or open an issue on Github.
Amazon Cognito Identity
Getting Started with the AWS Mobile SDK for Unity
This page provides you with an overview of each AWS service in the AWS Mobile SDK for Unity, as well as instructions on how to set up Unity samples. You must complete all of the instructions on the Set Up the AWS Mobile SDK for Unity (p. 3) page before you start using the services below.
Amazon Cognito Identity
All calls made to AWS require AWS credentials. Rather than hard-coding your credentials into your apps, we recommend that you use Amazon Cognito Identity to provide AWS credentials to your application.
Follow the instructions in Set Up the AWS Mobile SDK for Unity (p. 3) to obtain AWS credentials via Amazon Cognito.
Cognito also allows you to authenticate users using public log-in providers like Amazon, Facebook, Twitter, and Google as well as providers that support OpenID Connect. Cognito also works with unauthenticated users. Cognito provides temporary credentials with limited access rights that you specify with an Identity and Access Management (IAM) role. Cognito is configured by creating a new Identity Pool that is associated with an IAM role. The IAM role specifies the resources/services your app may access.
To get started with Cognito Identity, see the Amazon Cognito Developer Guide.
Amazon Cognito Sync
Cognito Sync makes it easy for you to save end users data such as user preferences or game state to the AWS Cloud so that it can be made available to users regardless of the device that they are using.
Cognito can also save this data locally, allowing your apps to work even when an internet connection is not available. When an internet connection becomes available, your apps can sync their local data to the cloud.
To get started with Cognito Sync, see the Amazon Cognito Developer Guide.
Using the CognitoSyncManager sample
In the Project pane, navigate to Assets/AWSSDK/examples/CognitoSync, and in the right-hand side of the pane select the CognitoSync scene to open the scene.
To run the sample click the play button at the top of the editor screen. When the app runs it displays a few text boxes and buttons that allow you to enter some player information. Below this, there are a series of buttons that save the player info locally, sync the local player info with the Cognito Cloud, refresh player info from the Cognito Cloud, and delete the local player info. Press each button to perform an operation. The sample displays feedback on the top of the game screen.
To configure the CognitoSyncManager sample, you must specify a Cognito Identity Pool ID. To specify this value, in the Unity editor, select SyncManager in the Heirarchy pane, and enter it into the IDENTITY_POOL_ID text box in the Inspector Pane.
Dynamo DB
NoteThe CognitoSyncManager sample contains code that illustrates how use the Facebook identity Provider, search for the “USE_FACEBOOK_LOGIN” macro. This requires use of the Facebook SDK for Unity. For more information, see Facebook SDK for Unity.
Dynamo DB
Amazon DynamoDB is a fast, highly scalable, highly available, cost-effective, non-relational database service. DynamoDB removes traditional scalability limitations on data storage while maintaining low latency and predictable performance.
The AWS SDK for Unity provides both low-level and high-level libraries for working with DynamoDB.
The high-level library includes the DynamoDB Object Mapper, which lets you map client-side classes to DynamoDB tables; perform various create, read, update, and delete (CRUD) operations; and execute queries. Using the DynamoDB Object Mapper, you can write simple, readable code that stores objects in the cloud.
For more information about DynamoDB, see DynamoDB Developer Guide.
For more information about using Dynamo DB from Unity Applications, see Amazon DynamoDB (p. 21).
Using the DynamoDB Sample
In the Project pane, navigate to Assets/AWSSDK/ examples/DynamoDB. This sample is composed of the following scenes:
• DynamoDBExample - the initial scene of the app
• LowLevelDynamoDbExample - example using low-level DynamoDBD API
• TableQueryAndScanExample - example showing how to perform queries
• HighLevelExample - example using high-level DynamoDB API
Add these scenes into the build (in the order they appear above) by using the Build Settings dialog (open by selecting File.Build Settings). This sample create four tables: ProductCatalog, Forum, Thread, Reply.
To run the sample click the play button at the top of the editor screen. When the app runs it displays a number of buttons:
• Low Level Table Operations - illustrates how to create, list, update, describe, and delete tables.
• Mid Level Query & Scan Operations - illustrates how to perform queries.
• High Level Object Mapper - illustrates how to create, update, and delete objects.
Mobile Analytics
Using Amazon Mobile Analytics, you can track customer behaviors, aggregate metrics, generate data visualizations, and identify meaningful patterns. The AWS SDK for Unity provides integration with the Amazon Mobile Analytics service. For information about Mobile Analytics, see Mobile Analytics User Guide. For more information about using Mobile Analytics from Unity Applications, see Amazon Mobile Analytics (p. 13).
Configuring Mobile Analytics
Mobile Analytics defines some settings that can be configured in the awsconfig.xml file:
Using the Mobile Analytics Sample
• sessionTimeout - This the time interval after an application goes to background and when session can be terminated.
• maxDBSize - This is the size of the SQLIte Database. When the database reaches the maximum size, any additional events are dropped.
• dbWarningThreshold - This is the limit on the size of the database which, once reached, will generate warning logs.
• maxRequestSize - This is the maximum size of the request in Bytes that should be transmitted in an HTTP request to the mobile analytics service.
• allowUseDataNetwork - A boolean that specifies if the session events are sent on the data network.
Using the Mobile Analytics Sample
In the Project pane, navigate to Assets/AWSSDK/ examples/Mobile Analytics, and in the right-hand side of the pane select the Amazon Mobile Analytics Sample scene to open the scene. To use the sample, you need to add your app using the Amazon Mobile Analytics console. For more information about using the Mobile Analytics console, see Amazon Mobile Analytics User Guide.
Follow these steps to configure the sample before running:
1. Select the AmazonMobileAnalyticsSample game object.
2. Specify your App Id (created in the Amazon Mobile Analytics console) in the “App Id” field.
3. Specify your Cognito Identity Pool Id (created using the Amazon Cognito console at) in the “Cognito Identity Pool Id” field.
4. Ensure your authenticated and unauthenticated roles have permissions to access the Mobile Analytics service. For more information about applying policy to IAM Roles see, Managing Roles.
When running the sample application, be aware that events may not be transmitted to the backend service immediately. A background thread will buffer events locally and send them in batches to the Amazon Mobile Analytics backend at a regular interval (the default value is 60 seconds) to ensure your game’s performance is not adversely impacted. Due to the complex processing Amazon Mobile Analytics performs on your data, submitted events and corresponding reports may not be visible in the AWS console until up to 60 minutes after initial submission.
For more information on the reports provided by Amazon Mobile Analytics, see Report and Mobile Metrics.
Amazon S3
Amazon Simple Storage Service (Amazon S3), provides developers and IT teams with secure, durable, highly-scalable object storage. From Unity you can use S3 to store, list, and retrieve images, videos, music, and other data used by your games.
For more information about S3, see Amazon S3 and Getting Started with S3.
For more information about using S3 from Unity applications, see Amazon Simple Storage Service (S3) (p. 16).
Configuring the S3 Default Signature
Configuring the S3 Default Signature
The default S3 signature is configured as follows:
<s3 useSignatureVersion4="true" />
This is used to specify if you should use signature version 4 for S3 requests.
Using the S3 Sample
In the Project pane, navigate to Assets/AWSSDK/examples/S3, and in the right-hand side of the pane select the S3Example scene to open the scene. The sample illustrates how to list buckets, list objects within a bucket, post objects to a bucket and download objects from a bucket. Follow these steps to configure the sample before running:
1. Select the S3 game object in the Hierarchy pane.
2. In the Inspector pane enter values for S3BucketName and SampleFileName. S3BucketName is the name of the bucket used by the sample and S3SampleFileName is the name of the file the sample will upload into the specified S3 bucket.
3. Ensure your authenticated and unauthenticated roles have permissions to access the S3 buckets in your account. For more information about applying policy to IAM Roles see, Managing Roles.
To run the sample click the play button at the top of the editor screen. When the app runs it displays a number of buttons:
• Get Objects - Gets a list of all objects in all buckets in your AWS account.
• Get Buckets - Gets a list of all buckets in your AWS account.
• Post Object - Uploads an object to a specified S3 bucket.
• Delete Object - Deletes all object from a specified S3 bucket.
The sample displays feedback on the top of the game screen.
Amazon Simple Notification Service
Amazon Simple Notification Service is a fast, flexible, fully managed push notification service that lets you send individual messages or to fan-out messages to large numbers of recipients. Amazon Simple Notification Service makes it simple and cost effective to send push notifications to mobile device users, email recipients or even send messages to other distributed services. To get started with Amazon Simple Notification Service, see Amazon Simple Notification Service (p. 26).
AWS Lambda
AWS Lambda is a compute service that runs your code in response to requests or events and
automatically manages the compute resources for you, making it easy to build applications that respond quickly to new information. AWS Lambda functions can be called directly from mobile, IoT, and Web apps and sends a response back synchronously, making it easy to create scalable, secure, and highly available backends for your mobile apps without the need to provision or manage infrastructure. For more information, see AWS Lambda (p. 32).
What is Amazon Cognito Identity?
Amazon Cognito Identity
What is Amazon Cognito Identity?
Using Amazon Cognito Identity, you can create unique identities for your users and authenticate them for secure access to your AWS resources like Amazon S3 or Amazon DynamoDB. Amazon Cognito Identity supports public identity providers—Amazon, Facebook, Twitter/Digits, Google, or any OpenID Connect-compatible provider—as well as unauthenticated identities. Cognito also supports developer authenticated identities, which let you register and authenticate users using your own backend
authentication process, while still using Amazon Cognito Sync to synchronize user data and access AWS resources.
For more information on Cognito Identity, see the Amazon Cognito Developer Guide.
For information about Cognito Authentication Region availability, see Amazon Cognito Identity Region Availability.
Using a Public Provider to Authenticate Users
For information on using public identity providers like Amazon, Facebook, Twitter/Digits, or Google to authenticate users, see the External Providers in the Amazon Cognito Developer Guide.
Using Developer Authenticated Identities
For information on developer authenticated identities, see the Developer Authenticated Identities in the Amazon Cognito Developer Guide.
Amazon Cognito Sync
Cognito Sync is an AWS service and client library that enables cross-device syncing of application-related user data. You can use the Cognito Sync API to synchronize user data across devices. To use Cognito Sync in your app, you must include the AWS Mobile SDK for Unity in your project.
For instructions on how to integrate Amazon Coginto Sync in your application, see Amazon Cognito Sync Developer Guide.
Integrating Amazon Mobile Analytics
Amazon Mobile Analytics
Using Amazon Mobile Analytics, you can track customer behaviors, aggregate metrics, generate data visualizations, and identify meaningful patterns. For information about Mobile Analytics see AWS Mobile Analytics.
Integrating Amazon Mobile Analytics
The sections below explain how to integrate Mobile Analytics with your app.
Create an App in the Mobile Analytics Console
Go to the Amazon Mobile Analytics console and create an app. Note the appId value, as you’ll need it later.
Note
To learn more about working in the console, see the Amazon Mobile Analytics User Guide.
When you are creating an App in the Mobile Analytics Console you will need to specify a Cognito Identity Pool ID. To create a new Cognito Identity Pool and generate an ID, see Cognito Identity Developer Guide.
Integrate Mobile Analytics into Your App
To access Mobile Analytics from Unity you will need the following using statements:
using Amazon.MobileAnalytics.MobileAnalyticsManager;
using Amazon.CognitoIdentity;
Best practice is to use Amazon Cognito to provide temporary AWS credentials to your application.
These credentials let the app access your AWS resources. To create a credentials provider, follow the instructions at Amazon Cognito Identity (p. 11).
Instantiate a MobileAnalyticsManager instance with the following information:
• cognitoIdentityPoolId - The ID of the Cognito Identity Pool for your app
• cognitoRegion - The region for your Cognito Identity Pool, for example “RegionEndpoint.USEast1”
• region - The region for the Mobile Analytics service, for example “RegionEndpoint.USEast1”
• appId - The value generated by the Mobile Analytics Console when you add an app
Use the MobileAnalyticsClientContextConfig to initialize an MobileAnalyticsManager instance as shown in the following code snippet:
// Initialize the MobileAnalyticsManager void Start()
{ // ...
analyticsManager = MobileAnalyticsManager.GetOrCreateInstance(
new CognitoAWSCredentials(<cognitoIdentityPoolId>, <cognitoRegion>), <region>,
<appId>);
// ...
}
Record Monetization Events
NoteThe app ID is generated for you during the app creation wizard. Both of these values must match those in the Mobile Analytics Console.
The appId is used to group your data in the Mobile Analytics console. To find your app ID after creating the app in the Mobile Analytics console, browse to the Mobile Analytics Console, click the gear icon in the upper right-hand corner of the screen. This will display the App Management page which lists all registered apps and their app IDs.
Record Monetization Events
The SDK for Unity provides the MonetizationEvent class, which enables you generate monetization events to track purchases made within mobile applications. The following code snippet shows how to create a monetization event:
// Create the monetization event object
MonetizationEvent monetizationEvent = new MonetizationEvent();
// Set the details of the monetization event monetizationEvent.Quantity = 3.0;
// Record the monetiziation event
analyticsManager.RecordEvent(monetizationEvent);
Record Custom Events
Mobile Analytics allows you to define custom events. Custom events are defined entirely by you; they help you track user actions specific to your app or game. For more information about Custom events see Custom-Events. For this example, let’s say your app is a game, and you want to record an event when a user completes a level. Create a “LevelComplete” event by creating a new AmazonMobileAnalyticsEvent instance:
CustomEvent customEvent = new CustomEvent("LevelComplete");
// Add attributes
When the application loses focus you can pause the session. In OnApplicationFocus check to see if the app is being paused. If so call PauseSession otherwise call ResumeSession as shown in the following code snippet:
Recording Sessions
void OnApplicationFocus(bool focus) {
if(focus) {
analyticsManager.ResumeSession();
} else {
analyticsManager.PauseSession();
} }
By default, if the user switches focus away from the app for less than 5 seconds, and switches back to the app the session will be resumed. If the user switches focus away from the app for 5 seconds or longer, a new session will be created. This setting is configurable in the awsconfig.xml file. For more information, refer to the Configuring Mobile Analytics section of Getting Started with the AWS Mobile SDK for Unity (p. 7).
Create and Configure an S3 Bucket
Amazon Simple Storage Service (S3)
Amazon Simple Storage Service (Amazon S3), provides developers and IT teams with secure, durable, highly-scalable object storage. Unity developers can take advantage of S3 to dynamically load assets used by their games. This can make games initially download quicker from app stores.
For more information about S3, see Amazon S3.
For information about AWS S3 Region availability, see AWS Service Region Availability.
NoteSome of the samples in this document assume the use of a text box variable called ResultText to display trace output.
Create and Configure an S3 Bucket
Amazon S3 stores your resources in Amazon S3 buckets - cloud storage containers that live in a specific region. Each Amazon S3 bucket must have a globally unique name. You can use the Amazon S3 Console to create a bucket.
Create an S3 Bucket
1. Sign in to the Amazon S3 console and click Create Bucket.
2. Enter a bucket name, select a region, and click Create.
Set Permissions for S3
The default IAM role policy grants your application access to Amazon Mobile Analytics and Amazon
The default IAM role policy grants your application access to Amazon Mobile Analytics and Amazon