Hello again ?
I'm having some troubles with serialization of a class member / handle.
Consider the following scenario (AS class initialized directly from C++):
class Main
{
private CppObj@ m_cppObj;
Main(SomeOtherCppObj& someOtherCppObj)
{
@m_cppObj = CppObj(someOtherCppObj);
}
which is meant to mimic C++ behavior of:
class Main
{
public:
explicit Main(OtherObject* pOtherObj) : m_obj(pOtherObj)
{
}
Object m_obj;
};
Handles are used in the AS example because, sadly, the member initializer lists currently don't seem to be a thing in AngelScript. Please note that CppObj/Obj only has an explicit constructor with one parameter, and so it will simply not run if it was declared as a non-handle AS object due to No default constructor for object of type 'CppObj'
.
The issue I have that when trying to reload the script the object that handle m_cppObj
points to never seems to be restored, using unaltered AS serializer add-on. On one hand, I can kind of understand why it wouldn't - after all, the object itself is declared locally….
How to tackle this issue?