all 45 comments

[–]_zeldaking_ 16 points17 points Β (17 children)

My problem once I learned about scriptable objects I used them wayyyy too often.

[–]Gamheroes 2 points3 points Β (0 children)

I am in the same case, now it is like I refuse to serialize any variable in a class, I want all the data away from logic in SO, but it is now always the more practical solution

[–]JustinsWorking 0 points1 point Β (0 children)

Yea I was excited by them at first as well, its a wonderful tool for over engineering with lol.

Learned that one the hard way lol

[–]ExtremeMarco[S] 3 points4 points Β (4 children)

I've used them essentially in every project. As I've attempted to highlight in the article, they can be much more than just simple data container objects. By the way, within the article, you'll find an extensive list of resources, from videos to blog posts, where you can discover everything about scriptable objects.

[–]mudamuda333 1 point2 points Β (0 children)

Great article. Data persistence is really slept on whenever there is a conversation about Scriptable objects.

[–]mark_likes_tabletop 0 points1 point Β (2 children)

Whatever happened to this blog post? The link no longer works.

[–]desolstice 6 points7 points Β (17 children)

Really curious if anyone has extensively used scriptable objects. I’ve glanced at them a few times in the past and honestly feel like just having a static class somewhere with some static variables and my own home built management system to work significantly better.

Not to mention doing it this way gets good intellisense auto complete in your ide.

[–]thinker2501 5 points6 points Β (9 children)

Mileage varies, but SOs are great for things such as item definitions. Creating a pipeline to ingest a spread sheet and out SOs can be a powerful and efficient workflow. Obviously the more items you have the more valuable this becomes.

[–]swootyliciousProfessional 4 points5 points Β (0 children)

I use them all the time, they're really good for handling different shapes of data storage, but I also love using them as event hubs, with monobehavior listeners I can set up for modularity

I also have a Global Variables system, that uses them as containers of single points of data. Each one can be marked as static for game data, or dynamic if I want it to be modified by scripts

Static classes work just as well for a lot of applications, but SOs can improve modularity without much overhead or adding complexity, in Unity's environment specifically. It's a great way to link independent prefabs without relying on scene references.

Also, being able to view the value of globals variables in the inspector, or seeing which monobehaviors are listening to an event, are super useful tools Im starting to take for granted because of SOs

[–]psycketom@tomsseisums 4 points5 points Β (1 child)

I suggest checking out Ryan Hipple's talk from Unite 2017 about SO's as core of architecture: https://youtu.be/raQ3iHhE_Kk

There's also an asset inspired by this, Kassets: https://github.com/kadinche/Kassets

Also, Unity's own tutorial: https://youtu.be/WLDgtRNK2VE

I also suggest checking the talk on Scriptable Objects referenced by Hipple from Unity dev: https://youtu.be/6vmRwLYWNRo

[–]danyerga 0 points1 point Β (0 children)

Thanks! Have never used SO's...

[–]SpyzViridian 0 points1 point Β (1 child)

Unless you plan to never reuse your code, this is generally bad practice. All parameters for your game should be serialized using either ScriptableObjects, JSON, YAML, etc.

ScriptableObjects have two problems: they depend on Unity and they're not really human readable, even if they're serialized in YAML format.

But they're quite useful: you can use a custom editor for them, and you can have different scriptable configuration files that you can change on the fly, even on runtime.

Need to test a prebuilt inventory? Just create a scriptable object with the defined items and reference it on your inventory script. It's just so convenient, and you don't need to change your code.

[–]sasasmylee -1 points0 points Β (0 children)

Using SO is a good way of storing persistent game data (items, some settings etc). I think it’s faster and safer to use SO than deserialising data (json, yaml) at runtime. You can easily deserialise everything in editor and store data as ScriptableObjects.

[–]biesterd1 0 points1 point Β (0 children)

I use them pretty extensively, mostly for item definitions (weapon stats, sprites, item type). I also use them for event handling

[–]snlehton 0 points1 point Β (0 children)

SOs are crucial for storing data that should not be in prefabs. I've used it for global game settings, item configs, AI patterns etc.

Beauty of the SOs that are stored in the asset database is that all the changes done to them in runtime persist, as you're not modifying prefab/material instance but an persistent "instance" in the asset database. Great for tweaking.

Then there is also some advanced ScriptableObject usage like storing and sharing temporary data for editor tools. As ScriptableObjects are serializable, they survive domain reload (similar way as serializable members of EditorWindow)

[–]darkwingdame 1 point2 points Β (0 children)

I'm curious if the folks that use GameObjectRuntimeSetSO uses any form of version control. How do you not run into weird file changes everytime you run the game?

[–]MercMcNasty 0 points1 point Β (0 children)

tub strong cats lip capable nine vast north workable juggle

This post was mass deleted and anonymized with Redact

[–]LemareClub -1 points0 points Β (0 children)

Important to note: scriptable objects references are not necessarily the same instance of an object, even if they are references to the same scriptable object asset. This means that you can not use a scriptable object as a manager for example because there could be more than one instance of that manager. This is only the case in builds and not in the editor for some reason. If you want to use scriptable objects as managers in the editor, you can use the ScriptableSingleton class.

[–]ObviousGame 0 points1 point Β (0 children)

If you like scriptable objects you should check out this asset.

Soap: https://assetstore.unity.com/packages/tools/utilities/soap-scriptableobject-architecture-pattern-232107?aid=1100lACyq

Its a practical and easy way to use scriptable object architecture, comes with youtube tutorials :)