Page 1 of 1

Saving UnityEvents

Posted: Fri Jul 31, 2020 9:03 am
by Vinily
Hello there,

I am currently trying to fit EasySave3 to my needs. My main problem is, that UnityEvents are not being saved properly. I am currently saving and loading a GameObject in which I create children in runtime (currently directly in the editor, later by instantiating them). My problem is that every linkage I create inside of a UnityEvent is not saved at all. I created a CustomType for my script of course, and it is basically saving the variable of the event but it remains empty even if I attach functions to that event.

Is there a possibility to save this?

Greetings

Re: Saving UnityEvents

Posted: Fri Jul 31, 2020 2:54 pm
by Joel
Hi there,

It's not possible to save UnityEvents because they do not expose the required fields to serialise them.

Instead you would need to save a data structure which contains information about what state your UnityEvent is in, and then use this to manually recreate it.

All the best,
Joel