Private Fields in Abstract Base Class
Posted: Tue Aug 13, 2019 2:17 am
Hello,
I am running into a pretty odd issue where a private field in an abstract base class is failing to be serialized despite having the [SerializeField] attribute. But when I change the field from private to public or protected, then it gets serialized correctly. This is made even more strange since all the other private fields have no problem being serialized. I have tested saving the same field in another class as private and it worked fine as well (needless to say this took forever to debug). The field in question is a class which contains a couple of generic member variables which are being serialized, in case that matters. My work around for now is to set the field as protected.
Have you run into this issue in the past? It seems very niche. Thank you.
I am running into a pretty odd issue where a private field in an abstract base class is failing to be serialized despite having the [SerializeField] attribute. But when I change the field from private to public or protected, then it gets serialized correctly. This is made even more strange since all the other private fields have no problem being serialized. I have tested saving the same field in another class as private and it worked fine as well (needless to say this took forever to debug). The field in question is a class which contains a couple of generic member variables which are being serialized, in case that matters. My work around for now is to set the field as protected.
Have you run into this issue in the past? It seems very niche. Thank you.