Unreal Engine Access violation, where should I put my game code?

Exception thrown at 0x00007FFBC520AA51 (nakama-cpp.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

I’m getting the Email and password from a blueprint widget and calling a c++ function which calls the client->authenticateEmail(email, password, "", false, {}, successCallback, errorCallback) function but all the variables after the success callback, ie Session, rtClient are all Null pointers. The console shows that a request has been sent to the server and the server has responded. the same code used to work before but now it doesnt.

This is what i get when i put a breakpoint right before i press the button which calls the authenticate function and it stays that way after its called.
client: shared_ptr <Information not available, no symbols loaded for nakama-cpp.dll> [1 strong ref] [<Information not available, no symbols loaded for nakama-cpp.dll>]
rtClient: shared_ptr <Information not available, no symbols loaded for nakama-cpp.dll> [1 strong ref] [<Information not available, no symbols loaded for nakama-cpp.dll>]
session: shared_ptr <Information not available, no symbols loaded for nakama-cpp.dll> [1 strong ref] [<Information not available, no symbols loaded for nakama-cpp.dll>]

The error was caused by unreal deleting the pointer when changing levels. if possible please add a file structure to the unreal client documentation as its pretty hard for a newbie to know which files to write code in thanks!

i fixed the issue by writing all the networking code inside the GameInstance class so that the nakama variables can persist accross levels

2 Likes

@SnappierSoap318 can you open a feature requests on the docs for us to cover this for Unreal? Thanks :pray: