Unity Save Game System Tutorial | Save Data To JSON

  Рет қаралды 12,489

Dan Pos

Dan Pos

2 жыл бұрын

🚨 Wishlist Revolocity on Steam! store.steampowered.com/app/27... 🚨 In this Unity save and load system tutorial I will show you how to save data in Unity out to a JSON file and then load the save game back into Unity.
📁 Get access to my tutorial project files over on Patreon: / danpos
💬 Join in with the Blender and Game Dev conversation over on The Creative Magpie Discord Server: / discord
❤️ Find me elsewhere on the internet:
Gumroad: gumroad.com/danpos_
Twitter: / danpos_
Instagram: / danpos_
📜 If you like this video and want to develop your skills I can highly recommend the following courses I have taken*:
GameDev.tv Courses: www.gamedev.tv/courses?affcod...
Blender 2.8 Launch Pad Course: academy.cgboost.com/p/blender...
Substance Painter Launch Pad: academy.cgboost.com/p/substan...
Unreal Engine Blueprint Game Developer:
click.linksynergy.com/deeplin...
Unreal Engine C++ Developer:
click.linksynergy.com/deeplin...
Blender 3D Sculpting for Beginners: click.linksynergy.com/deeplin...
Beginning C++ Programming:
click.linksynergy.com/deeplin...
The Ultimate Guide to Game Development With Unity:
click.linksynergy.com/deeplin...
🖱️ This is the gear that I use to create*
Lenovo L24Q - QHD 24" Monitors: amzn.to/3s6Rba0
BONTEC Dual Monitor Arm: amzn.to/3s7tgr1
Logitech G213 Keyboard: amzn.to/38pe3tq
Logitech Z333 2.1 Speaker System: amzn.to/2LBdNic
Logitech 720p Webcam: amzn.to/39eyecG
Blue Yeti Microphone: amzn.to/2Le7EbB
Corsair VOID ELITE RGB Headphones: amzn.to/35i50bB
Corsair Harpoon RGB Optical Gaming Mouse: amzn.to/3olwCUV
Corsair iCUE LS100 Smart Lightin Strip Starter Kit: amzn.to/3q5mMXP
Corsair iCUE 465X RGB Case: amzn.to/3noyNpp
Corsair Hydro 100i RGB Cooling System: amzn.to/3q0K8xH
RTX 2060: amzn.to/35kewLF
Large Mouse Mat: amzn.to/2MEQdBn
Gel Wrist Rest: amzn.to/3bj3Pg0
Video Music Provided by EpidemicSound: www.epidemicsound.com/referra...
*These are affiliate links which means I receive a small commission if you decide to buy something - the price will be no different to you though! I would massively appreciate any support :) *

Пікірлер: 52
@HB-wk6zj
@HB-wk6zj Жыл бұрын
I've never knew that it was that easy to actually save and load using JSON... Thank you so much for this excellent tutorial! Your KZbin Channel is a blessing for every developer.
@DanPos
@DanPos Жыл бұрын
Glad it was helpful!
@WakingDragon
@WakingDragon Жыл бұрын
Really high quality tutorial! Got me to my goal in one video :)
@calebadkins1828
@calebadkins1828 2 ай бұрын
You absolutely saved my game making, it took me a minute to make this work for my game but it worked. You are a beautiful man. I tried several different options and this is the only one that actually did anything, including just creating a save path!
@DanPos
@DanPos 2 ай бұрын
Glad I could help 😃
@graytreegames6151
@graytreegames6151 2 жыл бұрын
I've really been enjoying your inventory/saveload tutorials. The only issue I've run into is missing using statements, which isn't always clear in the videos what using statements were added. I did manage to figure out those, but as a bit of a new game dev student, it would have been helpful to highlight additions to those. Thanks for creating such a great series of tutorials.
@DanPos
@DanPos 2 жыл бұрын
Hey thanks for the feedback! That's a good point, my IDE will add them for me as I go usually so sometimes I forget to mention them.
@therendeath4886
@therendeath4886 Жыл бұрын
@@DanPos What IDE do you use? (It's lookin pretty darn awesome)
@DanPos
@DanPos Жыл бұрын
@@therendeath4886 I use Rider :)
@lxs030
@lxs030 Жыл бұрын
Your the best, thank you
@DanPos
@DanPos Жыл бұрын
My pleasure!
@322ss
@322ss 2 жыл бұрын
Thanks for the video. AFAIK concatenating path part strings should be done using Path Combine, not using plus symbol - IIRC Combine takes care of using proper separator character for each platform.
@GameBob
@GameBob 10 ай бұрын
will this work on a bunch of instantiated objects? I've been looking everywhere for a way to save creations the player makes.
@GameBob
@GameBob 10 ай бұрын
I wouldn't mind just being pushed in the direction of a tutorial on this that works for what I'm talking about. I've tried so many different methods and the only one I found that resembled what I need unfortunately didn't work because the video was missing context (not yours)
@DanPos
@DanPos 10 ай бұрын
Check out my base building tutorial, I cover saving and loading player made bases in that
@Tobiman12
@Tobiman12 Жыл бұрын
also the files of that project aint in your patreon but keep up the good job u r doing importent videos for our community
@DanPos
@DanPos Жыл бұрын
Thanks, they should be up there though! I'll have to look when Im back from vacation
@charlieelane2047
@charlieelane2047 Жыл бұрын
I’m following your Inventory System Tutorial and I’ve implemented all the save stuff and it all works (yay!) but how would I add the load button to my Start Menu Scene? So I’m on the start menu scene, I click load and it takes me to my save (which is in a different scene).
@charlieelane2047
@charlieelane2047 Жыл бұрын
I'm halfway there with this, I got it all to work but I can't figure out how to load my save scene. I have got my current scene name to save in the save data but can't get it to load!
@AA-ik7jq
@AA-ik7jq 10 ай бұрын
Hi did you ever figure it out? I think that might be to do with saving between scenes
@aeozithzene
@aeozithzene Жыл бұрын
Will not allow me to put var dir:string = Application.persistentDataPath + SaveDirectory; . Gives me the errors CS1513, CS1001, CS1002, and CS0818. I'm not sure how you typed it and it auto correct into that line. Won't do it for me, could you explain how you did it, do I need to download something for my VS? Thank you.
@DanPos
@DanPos Жыл бұрын
You've put var dir:string, should it not just be var dir, where's the : come from?
@watercat1248
@watercat1248 2 жыл бұрын
To by honest I'm working is multiplayer game and the only reason I want save system is for the setting and player settings if use json I will able to save those data ? And because this for the settings I will perfer if the load happened automatic wean the player enter the game
@DanPos
@DanPos 2 жыл бұрын
Yeah that will be fine as long as you don't mind them editing the file. To load just make it load in a gamemanager or something when you start the game
@watercat1248
@watercat1248 2 жыл бұрын
@@DanPos I don't I will by problem because like saying this for the setting and the player settings for example If Saman chenge the default sensetivity or resolution with the own it's his dision not mine I don't think I have problem with that is kind the opiset in because I will have able set up custom resolution if the want to Like Said the only thing I will by able to chenge is the setting and the player settings Not position and not such so the are very limited the stuff that I will able to changed
@DanPos
@DanPos 2 жыл бұрын
@@watercat1248 youre probably just best using PlayerPrefs for that sort of stuff
@watercat1248
@watercat1248 2 жыл бұрын
@@DanPos Wow I don't know playerperf is thing thenks this save my off a lot off work
@calebadkins1828
@calebadkins1828 2 ай бұрын
I hope you will see this comment very soon, at 11:55 you set a temporary string. I am not understanding how this is done. I see you write string and then it immediately disappears when you write var, is there a hotkey you a pressing to do this?
@calebadkins1828
@calebadkins1828 2 ай бұрын
Sorry, 11:50
@DanPos
@DanPos 2 ай бұрын
With rider you can hit alt+enter but just either use var or string doesn't matter which
@AnthonyMerlyn
@AnthonyMerlyn Жыл бұрын
Hey I Love your Inventory Tutorials! Could you do a Video, or tell me if its already exists... about accessing the toolbar with the keys 1-0? and maybe with that a using function? f.e. healing or equiping ?
@TapeStixxy
@TapeStixxy Жыл бұрын
Hey, I'm thinking about doing the same thing soon, so if I find a way to do it, I'll make sure to share it with you (Although it probably won't be nearly as efficient or as clean as if Dan were to do it! )
@micheleguardabasso8162
@micheleguardabasso8162 2 жыл бұрын
can you please help me for save and load system in unity my project don't wok if we can will see
@DanPos
@DanPos 2 жыл бұрын
Are you having an error following this tutorial?
@micheleguardabasso8162
@micheleguardabasso8162 2 жыл бұрын
@@DanPos no i have a project that don't work nice your project! Can you please help me if you have wat app i can send project and if you can will see is save load system with object in forlder resouces that don't work if we can doing a webcam so you can exspail i take of tow year for learn save and load system in unity :)
@Tobiman12
@Tobiman12 Жыл бұрын
u dont tell us all the shortcuts u do and its really frustrating.. like how did u do the prettyPrint? or the paths... or contents... 15:15
@themattstrauss
@themattstrauss 4 ай бұрын
'A pain in muh buht' 41:30
@PeterMilko
@PeterMilko Жыл бұрын
Tells me path is denied. HELP
@DanPos
@DanPos Жыл бұрын
At which point does it tell you the path is denied?
@PeterMilko
@PeterMilko Жыл бұрын
I fixed it by doing using FileStream stream = File.Create(Application.persistentDataPath);
@LJ_Dev
@LJ_Dev Жыл бұрын
@@PeterMilko Same here. UnauthorizedAccessException: Access to the path 'C:\Users\USERNAME\AppData\LocalLow\COMPANY\PROJECT\SaveData\' is denied. I solve this already. In my case, my problem was that I was missing the [SerializeFIeld] in the SaveData class properties. But it was NOT a folder permission or access stuff... That drove me crazy.-
@therendeath4886
@therendeath4886 Жыл бұрын
How to save scriptable objects?
@DanPos
@DanPos Жыл бұрын
You can't save changes to Scriptable Objects by default, you would need to make a save data struct for the information you want saved and then save / load that into the scriptable object when appropriate
@therendeath4886
@therendeath4886 Жыл бұрын
@@DanPos alright ty for answering, I'll look more into it myself, your tutorials are great btw
@elbowza
@elbowza Жыл бұрын
made my file extension .sus
@fabricioronison
@fabricioronison Жыл бұрын
Does this work on Android?
@DanPos
@DanPos Жыл бұрын
It should do yes
@kamuisw
@kamuisw 2 жыл бұрын
hi^^
@DanPos
@DanPos 2 жыл бұрын
Hey!
@frizonplay2700
@frizonplay2700 2 жыл бұрын
How to delete a save with a code?
@DanPos
@DanPos 2 жыл бұрын
You can use File.Delete docs.microsoft.com/en-us/dotnet/api/system.io.file.delete?view=net-6.0
@frizonplay2700
@frizonplay2700 2 жыл бұрын
@@DanPos Thank you!
Кәріс өшін алды...| Synyptas 3 | 10 серия
24:51
kak budto
Рет қаралды 1,3 МЛН
How to bring sweets anywhere 😋🍰🍫
00:32
TooTool
Рет қаралды 33 МЛН
🍕Пиццерия FNAF в реальной жизни #shorts
00:41
How to make a Save & Load System in Unity | 2022
26:56
Shaped by Rain Studios
Рет қаралды 175 М.
1 Art Pack, 5 Games, 2 Game Engines! | Game Dev Collab
20:37
How to save data between Scenes in Unity
9:44
Sunny Valley Studio
Рет қаралды 31 М.
How To Create An Advanced Save System In Unity
16:00
Dapper Dino
Рет қаралды 31 М.
skibidi toilet - season 24 (all episodes)
25:14
DaFuq!?Boom!
Рет қаралды 15 МЛН