Data Communication with AWS: Part 1- App Dev Series 7

Objective: serialize the data file into format that can be used to send it to AWS.

Photo by Markus Spiske on Unsplash

In the upcoming articles, we would create a file from data inside the app, then make Unity communicate with AWS and allow us to upload or download the file from it as database, which is also a save/load function.

Concept

To run this part, we would need to serialize the data into some file format(ex. json), and upload it to AWS as saving.
When we need to load some process of our app or game, just download that file and de-serialize it back to data, so Unity would be able to read it.

System.Serializable is an example to serialize a data to editable content in Unity

Serialize file into binary format

In this article, I would do the example with a data called “case” to serialize.
To enable switching format from data to file, we need to use the specific library.

After using the library, create a binary format variable for a later use by using BinaryFormatter.

Once done, we need to use another library to enable the function of creating file.

Now we can use FileStream to set a file type with assigned format name, and a persistent directory to save that file.

In here, we set the case id number as file name and dat format.

Once finished setting the format and directory, use BinaryFormatter.Serialize() to make the “case” data into file.

After serialized, close the file to finish this process.

That’s all to create this serialization function.
It should create a file in your persistent data path folder when the method has been called.

Now we successfully create a file from the data, we would continue uploading this file and to AWS.

--

--

--

A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

If your Python code throws errors, check these things first

Man in front of computer screen with Python on it

Python Cybersecurity For Beginners — Build Anonymous FTP Scanner

Remote Deployment to Glassfish v6 using Cargo Local Deployer

SRE Bootcamp Series — Importance Of Software Engineering

Accelerating time to insight with Dremio’s Snowflake Connector

Attributes srcset + sizes in <img> tag

How To Start With Mobile Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Making Sure Your Code Is Clean Through Automation

How to setup Git for a Unity project

Configure AWS Mobile SDK for Unity!

Creating enemy movement behavior