Myvideo

Guest

Login

Storing Data (Objects & Lists) with JSON - Unity Tutorial 2021

Uploaded By: Myvideo
1 view
0
0 votes
0

In this tutorial you'll learn how to save and read data into JSON files. We focuse more on lists which needs a little bit more code than default objects, but the latter one is also explained. JSON files store data in key-value pairs and are mainly used in web languages for communication between client and server, but it is also quite useful for games. Especially since Unity comes with a lightweight JSON serializer. This one unfortunately can natively only convert objects into JSON strings. But storing basic lists is also a very big part in games, e.g. for highscores. This tutorial acts as a preparation for my highscore list tutorial and uses this usecase. However the result is a generic FileHandler script, which can save and than read whatever you want. It just lacks of file validation and error handling, which is not part of this video. Explanation to (04:03): Go to or whatevery wegpage you want. Press F12 or right click and select “Inspect“ or something like this. The developer console should have opened. Navigate to the “Network“ tab and filter the results by selecting “XHR“. Reload the page to record the initially loaded data. Now you can see the Http request that were made. StackOverflow Link (07:27) ========= 💻 CODE: 💬 DISCORD: ❤ SUPPORT ME: 🎮 PLAY MY GAMES: 🦜 TWITTER: 💡 ...MORE TUTORIALS: ========= Timestamps: 00:00 - Intro 00:23 - Setup Explanation 02:50 - Creating the FileHandler - Writing 03:40 - JSON Explanation 04:24 - Saving the Data 11:45 - Reading the Data 14:36 - Saving & Reading Single Objects 16:02 - Additional Information

Share with your friends

Link:

Embed:

Video Size:

Custom size:

x

Add to Playlist:

Favorites
My Playlist
Watch Later