If you get crash, check logs in Saved/Logs it should also apper in output tab… because you error is very simple and engine should inform you
You can’t use “new” on UObject, they have diffrent creation process, to instatiate UObject use this insted:
static UNetworkConnection instance(NewObject<ULoginPacketHandler>());
You also should not use delete on UObject, you can only use those on non-UObject and non-reflected objects
Hello everyone.
I created a third person template project (C++), added a few classes, and I’m now trying to call a function of one of these newly added classes. I can call that function NP through C++ IF the class do not extend UObject. If it does, UE simply crashes when the function is called. I need it to extend UObject because I need to retrieve some variables, as well as execute some functions, from blueprints.
The error I’m getting when hitting the function while its holding class is a child of UObject: http://puu.sh/oAFag/198a3e5465.png
The function triggering the UE4 crash when called while its class extends UObject:
UNetworkConnection& UNetworkConnection::GetLoginInstance()
{
static UNetworkConnection instance(new ULoginPacketHandler());
return instance;
}
It likely is something pretty simple yet I can’t seem to figure it out. Been trying on and off for a few days but being new to both Unreal and C++, I’m struggling.
Please help!
Thanks for the answer, that was it!