I have a class like this:
struct EnemyTypeDetails {
//...blah...
};
class Enemy {
public:
Enemy(const EnemyTypeDetails &type) : typeRef(type) { }
const EnemyTypeDetails &typeRef; //What I want, but can't register
const EnemyTypeDetails *typePtr;
}
This crashes: within the ‘RegisterObjectProperty
()’ function.asCheck(engine->RegisterObjectProperty("Enemy", "const EnemyTypeDetails &type", asOFFSET(Enemy, typeRef)));
It crashes with the following error from my debugger:
The inferior stopped because it triggered an exception.
Stopped in thread 0 by: Exception at 0x7ff7c2ae805e, code: 0xc0000005: read access violation at: 0x186b0, flags=0x0
Am I registering the reference wrong?
This does not crash: (exposing a pointer member instead of a reference member)asCheck(engine->RegisterObjectProperty("Enemy", "const EnemyTypeDetails &type", asOFFSET(Enemy, typePtr)));
Note: I'm using Angelscript 2.36.0