Page 1 of 1

ES3Type from abstract class

Posted: Wed Oct 18, 2023 12:45 pm
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 )

Re: ES3Type from abstract class

Posted: Wed Oct 18, 2023 1:04 pm
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

Re: ES3Type from abstract class

Posted: Wed Oct 18, 2023 1:37 pm
by Kasper
Makes sense. Probably gonna stick with that. Thanks!