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? - Unity Tutorial
From the course: Unity: AR Visualization 02 Basic Interactivity
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.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
How and where is your data to be saved?54s
-
(Locked)
Creating the part dynamic data structure2m 32s
-
(Locked)
Creating the save method4m 20s
-
(Locked)
Creating the load method4m 40s
-
(Locked)
Creating the reset method1m 53s
-
(Locked)
Adding the data buttons to the parts menu5m 4s
-
AR app in action1m 13s
-
(Locked)
-