2
gaben
7y

I guess I'll just die.

Using unity for a commission project:
Have a CCG-like setup, the cards inherit from Scriptable object, need to serialize a card inventory for the sake of persistence.
Attempt 1: XML serialization: get fucked, can't serialize dictionaries (what the hell)
Attempt 2: using data representation of the dictionary contents: get fucked, can't serialize Scriptable objects because they have to be handled by the engine...
Well okay, what if I use a Scriptable object to keep a persistent dictionary?
Attempt 3: Scriptable object with dictionary: get fucked, the dictionary didn't persist
Well now I'm starting to lose it, I've tried so many things, XML, Binary and JSon serialization, Scriptable objects, data representations, I'm really running out of ideas. I can only think of one more option: throw the Card objects into a Resources folder, an build a set of comma delimited strings to serialize. This is stupid.

Fuck Unity. Shit like this is why I'm making my own engine. Every week I find some new peeve, some new way that unity is full of redundancy and poor design, architectural flaws and workflow deficiencies. I don't know how much more of this I can take.

Comments
  • 0
    attempt 4: manually add XElement ToXml() function on card class. shouldn't be that hard. then add the same on inventory, few its properties, the rest is just loop over card.ToXml. then add constructor to those objects that takes XElement as parameter. done. not that hard if you're willing to spend 2 hours actually coding instead of looking for a way to avoid coding. sorry, but making things automatic through library/language feature is not the only option. eventually you'll have to have some manual saving code anyways
  • 0
    @Midnigh-shcode I actually did try that as part of attempt number 1, unity wasn't having any of it. The issue isn't trying to avoid code, it's that every single code solution is shut down in some new way.
Add Comment