Saving UnityEvents

Discussion and help for Easy Save 3
Post Reply
Vinily
Posts: 3
Joined: Fri Jul 31, 2020 8:59 am

Saving UnityEvents

Post 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
User avatar
Joel
Moodkie Staff
Posts: 4846
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving UnityEvents

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply