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

**URL:** <https://forum.heroiclabs.com/t/unreal-engine-access-violation-where-should-i-put-my-game-code/1638>\
**Category:** Game Design\
**Tags:** authentication, sdk-unreal\
**Created:** [May 13, 2021, 9:04am UTC](https://forum.heroiclabs.com/t/unreal-engine-access-violation-where-should-i-put-my-game-code/1638 "2021-05-13T09:04:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SnappierSoap318](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/snappiersoap318/32/627_2.png) [@SnappierSoap318](https://forum.heroiclabs.com/u/SnappierSoap318)\
**Post date:** [May 13, 2021, 9:04am UTC](https://forum.heroiclabs.com/t/unreal-engine-access-violation-where-should-i-put-my-game-code/1638/1 "2021-05-13T09:04:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![SnappierSoap318](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/snappiersoap318/32/627_2.png) [@SnappierSoap318](https://forum.heroiclabs.com/u/SnappierSoap318)\
**Post date:** [May 13, 2021, 9:06am UTC](https://forum.heroiclabs.com/t/unreal-engine-access-violation-where-should-i-put-my-game-code/1638/2 "2021-05-13T09:06:58Z")

</div>

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>]`

---

<div class="post-metadata">

**Author:** ![SnappierSoap318](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/snappiersoap318/32/627_2.png) [@SnappierSoap318](https://forum.heroiclabs.com/u/SnappierSoap318)\
**Post date:** [May 21, 2021, 1:04pm UTC](https://forum.heroiclabs.com/t/unreal-engine-access-violation-where-should-i-put-my-game-code/1638/3 "2021-05-21T13:04:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [May 22, 2021, 11:39am UTC](https://forum.heroiclabs.com/t/unreal-engine-access-violation-where-should-i-put-my-game-code/1638/4 "2021-05-22T11:39:46Z")

</div>

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