Crash on using GetWorld()->GetMapName();,

Well, as the title says. My crash log is here on pastebin and attached below. For now I have that line commented out. Any help would be appreciated!


Access violation - code c0000005 (first/second chance not available)

UE4Editor_CoreUObject + 1418634 bytes
UE4Editor_Engine + 9874002 bytes
UE4Editor_FLR_6001!AFLRCharacter::AFLRCharacter() + 784 bytes [f:\documents\unreal projects\flr\source\flr\private\flrcharacter.cpp:57]
UE4Editor_CoreUObject + 394351 bytes
UE4Editor_CoreUObject + 1592305 bytes
UE4Editor_CoreUObject + 1478354 bytes
UE4Editor_CoreUObject + 426071 bytes
UE4Editor_Core + 467600 bytes
UE4Editor_Core + 2132957 bytes
UE4Editor_Projects + 103181 bytes
UE4Editor_Projects + 103836 bytes
UE4Editor!FEngineLoop::LoadStartupModules() + 75 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launchengineloop.cpp:1814]
UE4Editor!FEngineLoop::PreInit() + 10828 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launchengineloop.cpp:1373]
UE4Editor!GuardedMain() + 236 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\launch.cpp:110]
UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.6\engine\source\runtime\launch\private\windows\launchwindows.cpp:202]
UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

Where are you using it?

In the player constructor… I’m assuming the issue is that he loads in before the level?

1 Like

From what I understand, the GetWorld() is only a reference getter on your actor. GetWorld() could be not valid, but it does not mean the World is not up. Also, doing this in the constructor is probably not safe, since the constructor is called for every class at the start of the Editor (or Engine).

I personally use the GetWorld() from the GameInstance class to get my World Ref as it seems to be referenced there as soon as the GameInstance is created.

Hope this can help you.


Yup, got it. Thanks!

Solved thanks to Michaël Dubé. I just had to move it out of the player constructor.

I just switched my comment into answer, would be great if you can flag it as accepted :slight_smile: