From the course: Unity: AR Visualization 02 Basic Interactivity

Unlock the full course today

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

Creating the load method

Creating the load method - Unity Tutorial

From the course: Unity: AR Visualization 02 Basic Interactivity

Start my 1-month free trial

Creating the load method

- [Instructor] To create our Load method we're going to work backwards from our Save method. So let's create the method, public static void Load. All right, so the first thing we did was saved PlayerPrefs. So let's go get from PlayerPrefs, but before we get there we want to make sure that we actually have something to get. So let's do a check, if PlayerPrefs.HasKey, I'm going to use our PLAYER_PREFS_KEY. Then let's go and get it and parse it. Okay, let's get the JSON, string dataString is equal to PlayerPrefs.GetString, always make sure that it's in the same format, I'm going to put in our key in there. So now that we have the JSON, let's parse. All right, and this output of this is going to be ARPartManifest manifest and that's going to be equal to the JsonUtility.FromJson. You see these little angular brackets, this means that I can define a type that I want to cost to, and that's obviously going to be the…

Contents