ES3Type from abstract class

Discussion and help for Easy Save 3
Post Reply
Kasper
Posts: 2
Joined: Wed Oct 18, 2023 12:38 pm

ES3Type from abstract class

Post by Kasper »

Hey, would it be possible to create ES3 Type based on abstract class ?

My case is that i have abstract class called for example "GoapObject" and few other classes which inherit from it. Usually, i would need to create ES3Type script for each script that inherits from GoapObject but that's quite a lot of work. My idea was to have virtual functions in GoapObject like :

public virtual void WriteSerializeData(ES3Writer writer)
{

}
public virtual void ReadSerializeData(ES3Reader reader)
{

}

And then have just one ES3Type script to write and read these data.
I`m asking because I don`t see any option to create ES3 Type of abstract class from ES3Window ( there is no way to find this script ). Also don`t found any option to gather `Components` to save as root abstract class ( always cast to implementing class )
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3Type from abstract class

Post by Joel »

Hi there,

ES3Types need to be of the concrete type because it's not possible to create an instance of an abstract class. You could however create an ES3Type for one of your concrete types and then manually create ES3Types for your other concrete types which inherit from this.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Kasper
Posts: 2
Joined: Wed Oct 18, 2023 12:38 pm

Re: ES3Type from abstract class

Post by Kasper »

Makes sense. Probably gonna stick with that. Thanks!
Post Reply