Tutorial: Saving Scriptable Objects and Persistence in Release

preview_player
Показать описание
New video each Tuesday and Friday around 3:00pm GMT-0800.

Code:

Essential Talks on ScriptableObjects:

Essential Reading:

Want to learn how to make great looking Unity Asset Store scripts? We have a course you need to check out all about Unity Editor Scripting (Huge discount with bellow link):

Support the show by liking and subscribing or leaving a donation (It isn't cheap to review 2 paid assets each week so your support is most appreciated!) at:

Use your YouTube username if you would like a shout out on a later episode!
Рекомендации по теме
Комментарии
Автор

This is such a clean tutorial about saving data with scriptable objects, I wonder why Youtube algorithm doesn't favor it more.

marularch
Автор

This was a wonderful video, thanks this was just what I was looking for.

Sad to see you haven't posted in a year, I'd love to see more content today.

Once again thanks, you did me wonders.

synhayden
Автор

The ScriptableInt is such a great example of Minimum Viable Product, making exactly what you need to really show the concept you're discussing but no more. The result is a video that cleanly explains what's going wrong with persistence of SOs and then lays out a good fix. Absolutely excellent.

TheKarishi
Автор

I did it kkk! I have programed my entire application using lots of scriptable objects thinking they had persistent data, and it is an application where the user will create tasks, like a scheduller. At the end of 15 days when I thought it was all perfect I found out that the changes wouldn't be saved. Ohhhh, I almost went crazy kkkk. Thank a lot for the video!

ctreligar
Автор

A very useful and to-the-point video on how to actually use the Unity Scriptable Objects for persisting game state data (a.k.a. Save/Load).

dererzherzog
Автор

tysm! this was exactly what i was looking for! You just got a new subscriber

CodingInUnity
Автор

so clean and helpful, thanks so much!

venomradar
Автор

Hi, just want to say very nice tutorial. One thing I wanna add is the script you save the json string into 1 single file with multiple lines instead of creating a new file for each SO in the list. It will make the save folder less messy, especially if there are a lot of different SOs.

JumpCatStudio
Автор

Man this video was so calming and informative at the same time! Keep it up man!

morneerasmus
Автор

I want to note that there's no reason to serialize to binary _and_ serialize to JSON. Just do one or the other.

I recommend just using JSON, because you get nice readable save data that way (though, not great if you want to hide this data from your users).
Binary is good when you just want to plop an entire object on the disk and then to be able to load it directly back into your game with minimal processing (but be careful with any references your object has to other objects! These will likely break!)

C# makes JSON super easy, you can avoid that BinaryFormatter altogether. Just use File.WriteAllText and File.ReadAllText from the System.IO namespace to write/read the JSON strings directly to disk. Then you don't end up with all that binary junk that you saw in your save data. It's also great if you are subsequently sending that file to a web-server, as it's just plain JSON and nothing else, which is common on the web.

APaleDot
Автор

This is fantastic, awesomely helpful insights. Also really soothing to watch, makes it easier to sink in the concepts.

AurelioProvedo
Автор

1:10 "I'm very worried there's gonna be a lot of developers who go through the whole process of creating all their save data with scriptable object only to get to the end to find out that they're gonna have to figure out some way of managing that."

Literally what brought me to this video😅

benjamingerd
Автор

Amazing. This is exactly the solution I needed.

jimkeen
Автор

I love you man, i love the way you are teaching its awesome, i love the cap your are wearing, great tutorial .... :) Subscribed

ashishkushwaha
Автор

you saved me. thanks for this solution you keep me sane while solving this problem

CleosetricVlyers
Автор

Thank you so much I used this method to create my own Version counter and number of playtests tracker
I didn't care about it reseting when builds try to relaunch but that was useful information either way
to get the number of playtests I had to negate at least once before setting my string as it counts a playtest when you launch the game which isn't a playtest more or less just launching it

BilboStabbins
Автор

Usually in c# garbage system make clean automatically, but when we use Filestream, we've to dispose at the end of the code, or to use keyword 'using' . Anyway great job !

florinpricopie
Автор

Thank you for this. I was only using BinarySerialization but that causes issues with ScriptableObjects because it tries to serialize a specific private field which is not serializable, Unity shenanigans.
I stayed away from json because I wanted private fields, but it seems this is the only way outside of writing my own serialization. Thanks again!

bobo
Автор

So when you open the application back up and OnEnabled is called, why is your objectsToPersist.count not 0? how are you adding the files in the directory back to that array when the app loads? mine is 0... :(

jampakdd
Автор

I Have a question . Does this also save images that are put on the scriptable object, cause everytime i relaunch unity they go into none and i have to put the artwork up again.

combatmedic
join shbcf.ru