Closed hymerman closed 8 years ago
No not really. It's not really worth the extra complexity. Most if not all the times I found myself in a much better position just reconnecting the delegates values in initialization. In-inspector delegates are over-rated imo (good luck rewiring everything after Unity screws up your .scene files...)
That said, you could write a custom serializer for e.g. a VFW delegate and serialize the MethodInfo like this https://github.com/vexe/FastSerializer/blob/master/FastSerializer/Serializers/MetadataSerializers.cs - but the tricky part is always the 'target' object, because it could be a UnityEngine.Object (e.g. a MonoBehaviour) - what do you do then? ... you'd have to have some kind of storage of MonoBehaviours where each has a unique Id and [de]serialize the id. I believe I'm doing something similar in order to persist in-scene references so you could check that out as well.
Fair enough, thanks for the pointers!
I'll try to do this since I have the whole game state under one object, and certain sub-objects have delegates that call methods on other sub-objects (as scheduled events), which would be difficult to hook up again.
Is FastSave supposed to be able to save any kind of delegates, including VFW's own?
I tried this simple test (Under Unity 5.3.0f4; save in a file under an 'Editor' directory and use Window->Editor Test Runner), and I get an exception:
The exception: