How To Save And Load Your Game Data With Scriptable Objects - Unity

Поделиться
HTML-код
  • Опубликовано: 10 ноя 2024

Комментарии • 57

  • @bleblekime1815
    @bleblekime1815 4 года назад +9

    I've just realized something interesting: if you save this as a txt and try to open it in Sublime Text, it will show up hexadecimal code. However, if you use notepad, you will be actually able to see values and edit them.
    EDIT: Turns out you actually cant serialize scriptable objects. Even if you are will open sublime text or vs and see hexadecimal code, by opening you save the file by notepad you will be able to see and edit values. What you have to do is to create another object that is a pure c# class and load your scriptable object data to it. After that, you can serialize it and it should work properly.

  • @DustVoltrage
    @DustVoltrage 4 года назад +3

    Even if's a really good one, I have to say there are millions of these tutorial out there.
    What the community would really need is the more complexe situations : saving derived class from scriptable objects, non serializable stuff such as sprites and so on !
    Please Dino

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  4 года назад +4

      I'll do a more in-depth example next week that is more practical for bigger games :)

    • @DustVoltrage
      @DustVoltrage 4 года назад

      @@DapperDinoCodingTutorials awesome news !! 🙏

    • @ozeistudio6916
      @ozeistudio6916 4 года назад +1

      @@DapperDinoCodingTutorials am at 3jin but is this working with mobile ?

    • @oGSS52o
      @oGSS52o 4 года назад +1

      @@DapperDinoCodingTutorials Still planned ?

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  4 года назад +1

      I really need to make a public schedule so people can see what I'm planning with upcoming videos :p I will be doing a video today and tomorrow for Unity ML agents since they just came out of preview a week ago then I can do a video on more complex saving next week.

  • @kapkoder4009
    @kapkoder4009 4 года назад +3

    THANK YOU SOOO MUCH!!!! IVE BEEN LOOKING EVERWHERE FOR THIS!

    • @kapkoder4009
      @kapkoder4009 3 года назад +2

      @Skippy_xD don't tell anyone I watch tutorials

  • @jamiebates5522
    @jamiebates5522 6 лет назад +4

    RIP Bob, overwritten by Bill in his prime :P I guess if you wanted the filename to be a bit more mysterious than 'slot1.save', you could create some kind of hash using the filename and then use the hash as a filename instead. Very informatative, thanks for the video!

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  6 лет назад +1

      Yep, it's really up to you for deciding how secure you need or want it to be. I'm glad you liked the video :D

  • @sherlyhudson2198
    @sherlyhudson2198 5 лет назад +20

    Can you do a tutorial on inventory system that you can save and load?
    Saving string, int and float seem simple enough, but when it comes to inventory I have no idea how to implement it because there are images and slots etc.

    • @sus7820
      @sus7820 3 года назад

      Hey you still alive??

  • @dlxinteractive
    @dlxinteractive 5 лет назад +5

    17:49 how come when i saved my script to PlayerPrefs and open up the text file that stores my script it displays it in JSON but not in hexadecimal? it displays this: ÿÿÿÿ |{"startingHealth":20.0,"health":20.0,"moveSpeed":9.0,"crosshairs":{"instanceID":1009186},"deathEffect":{"instanceID":27244}} (yes this is the player script).

  • @duskjk1258
    @duskjk1258 2 года назад

    You are amazing. I have been looking for a method like this in which c# that how can I save whole class object data in a file. This json code is perfect. Thank you!

  • @ImmortalityYT
    @ImmortalityYT 5 лет назад +4

    Thanks by far the best tutorial I've seen on the topic! This is a dumb question but is character a class?

  • @iamgingerbread6558
    @iamgingerbread6558 Год назад

    Very Big Wow super Helpful you.Thanks !! xd

  • @michaeldiaz4285
    @michaeldiaz4285 2 года назад

    this tutorial was lit and str8 up to the point

  • @charlenejoyconcha3502
    @charlenejoyconcha3502 3 года назад +1

    can i save a data without replacing the old data? Can i CRUD this scriptable obj?

  • @kazimashiatsumaira1684
    @kazimashiatsumaira1684 Год назад

    Will this work after we give build, play game, quit application and then reopen application?

  • @흑심품은흑마법사
    @흑심품은흑마법사 2 года назад

    Thank you, solve my problem!!

  • @lonemastery
    @lonemastery 2 года назад

    is it better if you use playerprefs?

  • @alinazari2046
    @alinazari2046 4 года назад

    Holy Ricksus , i just saved a ScriptableObject with huge data and reloaded it on Android O_o

  • @theRealDonaldTrump666
    @theRealDonaldTrump666 5 лет назад +1

    thats auto save fast. no more waiting 30 - 50 seconds to save because i have 50 values that need to be individually sent through the pipeline. a few times in the past i wasnt sure if unity crashed or if it was doing it. i couldnt click on anything

  • @dannykessel6634
    @dannykessel6634 5 лет назад +2

    It worked when I was still building (and testing it) in Unity. But after the Build, the safe doesn't work anymore. What could this possibly be?

    • @judgegroovyman
      @judgegroovyman 3 года назад

      I know it’s been a long time but as I understand it scriptable objects can’t be written to in a build. Has anyone found out otherwise?

  • @RonBonomo
    @RonBonomo 5 лет назад

    I tried this, but it doesn't work if i try to save a list. It wont reload the list. When I am saving I use List items, i will put items int the bracket (json, items). But this doesn't seem to be saving or loading the info in the list. Could you tell me what I am doing wrong, if I am missing a function or something for saving a list that changes as game play goes on

  • @luluskuy
    @luluskuy Год назад

    Hi!
    Do this work on android? Is the path directory same?

  • @dan-mechanics2014
    @dan-mechanics2014 5 лет назад

    This is really awsome

  • @CDJaramillo92
    @CDJaramillo92 6 лет назад

    I'm trying to save the game and if the game is open again has a button to load a scene but with the current progress. what would I do?

  • @nemogames5354
    @nemogames5354 4 года назад +1

    I used this method and now im getting a lot of Type mismatch

  • @apurvasurve3294
    @apurvasurve3294 5 лет назад +1

    @DapperDino what is application in application.persistentdatapath where did you create that folder

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  5 лет назад

      I didn't create it, it's done automatically by unity because different operating systems use different file path structures. It essentially does the hard work for you when it comes to choosing where to put save data on a users device :)

    • @apurvasurve3294
      @apurvasurve3294 5 лет назад +1

      @@DapperDinoCodingTutorials when i add it in my code no option for application comes in suggestions, also it does not turn green

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  5 лет назад +1

      @@apurvasurve3294 It's part of the UnityEngine namespace so it should appear: docs.unity3d.com/ScriptReference/Application-persistentDataPath.html

  • @angelaaliangan2918
    @angelaaliangan2918 5 лет назад +1

    lol public Character is not showing dude . my script got an error

    • @VoltFall
      @VoltFall 3 года назад

      same any solutio- wait oh you have to watch his previous video to see the character

  • @Zenkoreal
    @Zenkoreal 6 лет назад +1

    Can you make a video how to make team bot for discord???
    So you can !team create
    And invite other people (max30)? I actually need it for my discord , but there arent any tutorial

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  6 лет назад

      All you would need is a list of members and to add the person to the list when they use the command. As we are currently building our branding and website/server with the channel we will be creating and selling specific, fully functional bots on our website, such as a scrim bots and so on due to the fact that we currently have no form of income and it costs us to do all of this.

    • @Zenkoreal
      @Zenkoreal 6 лет назад

      Dapper Dino - Coding Tutorials ok but i know nothing in coding so im trying to look for someone can made it or a tutorial

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  6 лет назад +1

      As I said, as one of the only possible ways for income we are creating and selling specific bots, either that or you start learning some basic coding because we don't just give out code for people to copy. We are here to teach :p

    • @Zenkoreal
      @Zenkoreal 6 лет назад

      Oh ok , thanks

    • @Zenkoreal
      @Zenkoreal 6 лет назад

      How many for this bot?

  • @charlenejoyconcha3502
    @charlenejoyconcha3502 3 года назад

    Hello guys can you help me. I have multiple accounts, leaderboards, trophy room and assessment record for my toddler game. but unfortunately i dont know how to do it because im a newbie in unity world. Is there any tutorials step by step or can you guys teach me how to do a CRUD step by step? Hope you guys help me.

  • @arifharsowiyono7242
    @arifharsowiyono7242 6 лет назад

    you not explain InputManager Script dude :v

  • @Aldin101
    @Aldin101 Год назад

    You should uninstall league of legends

  • @realurah
    @realurah Год назад

    thanks dude