#Wdym by format

1 messages · Page 1 of 1 (latest)

blissful sierra
#

For example, the prefabs currently have 3 List<Vector3>s, and I'm planning to switch it to List<class>, where the objects are a triple of Vector3s. And, if I just make that change in my object, the data will be lost in my prefabs

dawn wolf
#

Unity has no builtin support for migrations of that nature besides the serialization callbacks or additive format changes and custom implementations of these migrations based on the old/new fields.

dapper lark
#

I would also highly recommend using an actual struct or class type instead of object

blissful sierra
#

oh wait

#

sorry, I was conflating object and class

blissful sierra
#

@dawn wolf great, I got it working with ISerializationCallbackReceiver, thanks!

#

Out of my own curiosity - could I not achieve this with any sort of one-shot scripting? I did get the desired effect by modifying my class and forcing an OnBeforeSerialize, but:

  • it feels odd to implement this method, given that I'll be deleting the implementation after the migration
  • I'll have to figure out how to trigger an OnBeforeSerialize for all of my prefabs
  • I see that prefabs have human-readable serialization, so it seems like it would be simple enough to provide some sort of interface for modifying the prefab files
#

Though I get that this is an odd use-case, and it's not that hard to write but it's also probably not super in-demand

blissful sierra
#

@dawn wolf it ended up being the case that the OnBeforeSerialize step didn't necessarily write the serializations to Disk, so I had to get it to do so with this strategy

dawn wolf