Hmm it seems I've run into something again. I have a factory function for my LogicComponentScripted (c++ version of LogicComponent)
static void LCSFactoryArgs(asIScriptGeneric *gen)
{
void *parentComponent = gen->GetArgAddress(0);
LogicComponentScripted *self = reinterpret_cast<LogicComponentScripted*>(gen->GetObject());
assert(self != NULL);
gen->SetReturnAddress(new LogicComponentScripted((asIScriptObject*)self, (Component*)parentComponent));
}
Registration Function:
r = engine->RegisterObjectBehaviour(type, asBEHAVE_FACTORY, "LogicComponentInner@ f(ComponentInner@& in)", asFUNCTION(LCSFactoryArgs), asCALL_GENERIC); assert( r >= 0 );
It seems if I call GetObject when I create a LogicComponentInner inside of a Scripted object's constructor it returns NULL. Which sort of makes sense since the script object isn't done constructing. Is it possible to get a reference to the scripted object when creating a c++ object in the constructor of the scripted class?
Overall, what im trying to do is have a parallel C++ object that has a reference to a Scripted object and vice-versa.