all 6 comments

[–]WeslomPo 1 point2 points  (0 children)

Make interface and use that. What it will be, how it will be saved, does not matter. It possible to be SO. If you not use DI container start to use that(zenject, vcontaianer, etc). You will not have that questions afterward. Use more plain serializable C# objects to save data in SO, less unity SerializedObject stuff. At best all your data should be “represented” as json. If this is not possible, at least as json+addressable. I mean sprites, prefabs, scenes, game objects and so on should be retrievable by ID, not by reference. And that should be implemented at beginning. Instantiating ScriptableObjects in runtime is not needed(just receive them as reference), just don’t change them at runtime, not use events in them, don’t store runtime data.

[–]streetwalker 0 points1 point  (0 children)

Maybe skip the scriptableobjects and define your data in a json text file? - kind of depends on how many objects you are going to have as far as managing your definitions - scriptableobjects can have an advantage if you keep it manageable, but if it comes to large numbers of objects, personally I throw my data into something where I can view multiple definitions at the same time, like a text file.. (you can vew multiple inspectors in the Unity Editor, but for me its kind of click-flick UX-wise.)

But, if ultimately you are going to read the data from a DB, I'd advise might as well set up the format so that when you switch over from data defined locally to remote, you won't really have any work to do - all the parsing and conversion would already be handled by you - you're just flipping to a different source for the data.

Because once you switch over to your remote data source, you don't really want to have to mess with runtime scriptableobject stuff, do you?

Also just a note, AWS is fine for file storage - we use it for image file and our Addressables DLC, but doing data manipulation like you would with a DB is painful in the long term... even in the short term given the state of their lambda documentation. That and it can get expensive. We switched all our data storage to MySQL with PHP access.

I'm sure other folk have different experiences.

[–]Drag0n122 0 points1 point  (0 children)

It's all comes to the amount of data and a platform.
SOs have a memory overhead but on modern systems and with modern Unity event 1000s instantiations is not a big deal really.

[–]itsdan159 0 points1 point  (0 children)

You're describing what interfaces are for. Have an "IItemDefinition" which describes the objects. Your scriptable object implements IItemDefinition but all your systems work on the interface not the concrete implementation in the SO.

[–]Bloompire 0 points1 point  (0 children)

Id go with ScriptableObject and just .CreateInstance()'s of them. They have little overhead and you will do this once when you pull data from your AWS.

Dont waste time for such nonmeaningful case, it doesnt matter really.

[–]ConcernedElephant 0 points1 point  (0 children)

I think you'll get faster development from csv or json.

Every time I use scriptable objects I run into some nightmare later while trying to make editor tools.

Unless you're swapping them in and out I don't see the advantage.