From the course: Unity: AR Visualization 02 Basic Interactivity

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

How and where is your data to be saved?

How and where is your data to be saved? - Unity Tutorial

From the course: Unity: AR Visualization 02 Basic Interactivity

Start my 1-month free trial

How and where is your data to be saved?

- [Instructor] Now that we can actually move our jet engine parts and we can set their visibility, we want to save these states somehow. So we're going to be saving these states using the Unity PlayerPrefs. The scripting API gives you a good definition of what PlayerPrefs covers, most especially the locations on iOS and Android where the actual data gets saved as well as in the editor. PlayerPrefs doesn't take in object data. It takes in a few things, string, int, float. So what we're going to do is take our object data, convert it into a JSON and save it as a string. Luckily for us, Unity has a great utility to change things into JSON called the JsonUtility. Scripting API can give you more information, but this is the method that we're going to use. All right, on to some code.

Contents