Amazon AWS SDK hell...p

Hi guys,

(if you think this question belongs on AWS forum, please let me know)
(…also, I posted this as a forumn thread, but later felt that it’s really a question… or maybe not…)

I am not trying to do anything fancy, just a simple query on an existing table. All the permissions are open. I can make queries against this table in Python, but in Unity… the debugger seems to skip over all client.*Async calls.

Now, the cognito portion is fine as it sets the datasets.
With Dynamodb, it works ONCE right after I create a new cognito user pool. The second time around, the debugger steps right over the client.QueryAsync(...) call, as if it’s not even there.

I am using unity Unity-5-3.3f1 and AWS aws-sdk-unity_3.1.95.0.

So much said, here is the code:

using UnityEngine;
using System.Collections;
using System;
using Amazon;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DataModel;
using Amazon.DynamoDBv2.DocumentModel;
using System.Collections.Generic;
using Amazon.CognitoIdentity;
using Amazon.DynamoDBv2.Model;
using Amazon.Util;
using Amazon.Runtime;
using System.Text;
public class QuestionManager : MonoBehaviour
    public int limit = 5;
    public string content;
    public GameObject Cognito;
    private IAmazonDynamoDB client;
    private DynamoDBContext Context;
    private AWSCognitoSync cognitoSync;
    private CognitoAWSCredentials cred;
    public string resultText;
    public void qInit()
        cred = cognitoSync.Credentials;
        client = new AmazonDynamoDBClient(cred, RegionEndpoint.USEast1);
        Context = new DynamoDBContext(client);
    public void GetQuestions(string category)
        QueryRequest request = new QueryRequest();
        request.TableName = "Questions3";
        request.Limit = 10;
        request.ReturnConsumedCapacity = "TOTAL";
        request.KeyConditionExpression = "category = :v_id";
        request.ExpressionAttributeValues = new Dictionary<string, AttributeValue> {
          ":v_Id", new AttributeValue {
            S = category
        client.QueryAsync(request, (result) =>
            if (result.Exception != null)
                Debug.Log("Failed to Query");
            Debug.Log("Entered QuerySync");
            resultText = string.Format("No. of reads used (by query in FindRepliesForAThreadSpecifyLimit) {0}
            Debug.Log("resultText ---->" + resultText);
            foreach (var item in result.Response.Items)

Any thoughts would be appreciated.

Ok, found the issue.

Posting for the next guy who goes nuts over a non-issue…

The problem was… that the GameObject the Cognito was attached to was being destroyed as I loaded the next level…


Added a script to the Cognito GameObject to preserve it from one scene to another.

Here is the code:

using UnityEngine;
public class DontDestroyOnLoad : MonoBehaviour
    void Awake ()
        MonoBehaviour.DontDestroyOnLoad( this.gameObject );