Creating a search and callback system in Unity — part 1, getting a list of objects off s3.

After we now can successfully submit cases, we’ll need the ability to type in a case number and have the program list all the items in our bucket, search through them, and present them if found.

For our search button, we’ll have to come up with some code that will list the bucket items, search for the number, and display the next screen if found. The next step is to write some pseudocode:

Since we’re retrieving information from Amazon, we’ll head on over to the AWS manager and create a new method called GetList().

In AWSManager:

The code is mostly taken from the s3 example, we start with a new variable called request which will be Amazons ListObjectsRequest() class, and we’ll assign our bucketname inside of it.

After we create the request, we’ll need to use Amazon's client to send it. We give a new variable called responseObject like before to assign the response. If there are no exceptions, that’s a good thing, it means it went through so we do a for-each loop on responseObject using a lambda creating a new variable called obj which we’ll then list each key in a Debug.Log.

If there is an exception, we’ll get an error and we’ll make note of the exception.

Now the only thing we need to do is access it in our searchpanel…

For now, we won’t use actual input, we’ll just hardcode a fake number to see if the function actually works:

And here’s our output showing every case we’ve created so far! It works!!!

Next, we’ll parse the data and return the info the user searched for if it’s found!

cartoonist, game artist, and wanabe gamedev.