link textPersistentLevel->OwningWorld is null because UWorld::RepairWorldSettings is called from UWorld::PostLoad which happens before linking i guess ?
Make sure Example_Map is your startup map.
Its world settings should be the default one.
Then make a new world settings class.
Change the world settings in project settings to the new class without saving the Example_Map
Reload the editor
UE4 version 4.9 branch commit eca0d6aa82d2e07827b2ca39d848da147de0abe7
Can you reproduce this in a new project? I made the new class and set Project Settings → Engine → General Settings → World Settings Class to the class I created. After reastarting the editor (without saving) I did not receive a crash. If you’re able to reproduce this please include the steps you used so I can try to reproduce this on my end.
I just reproduced it by going into project settings, setting the base WorldSettings as the world settings class, relaunching the editor, making a new ‘Floor’ map (not the fully blank one), saving it. Relaunching the editor again, choosing my derived WorldSettings class in project settings, then relaunching it again, and trying to open the Floor map.
I’ve attached the dmp file and log with callstack.
Oh wait, did you make a Non-blueprint WorldSettings derived actor ?
It has to be blueprint for the error to happen.
Try making a blueprint deriving from the C++ class you just made.
Otherwise the code won’t get to the line that actually crashes.
I’m not sure I understand your process. I am unable to make a blueprint based on my custom World Settings class or the default World Settings class. Could you list the detailed steps you’ve taken to reproduce this.
Make your custom C++ WorldSettings Blueprintable, then you will be able to inherit it with a Blueprint
Then set that as your WorldSettings class in project settings. Loading any map after that will make it crash.
I’m still not getting a crash when opening the editor after changing world settings in my project settings. Here are the steps I’ve tried:
1) Create custom class based on World Settings (MyWorldSettings)
2) Added Blueprintable to the UClass() macro
4) Create a blueprint of MyWorldSettings (MyWorldSettings_BP)
5) Save the project
6) In Project Settings->Engine->General Settings change World Settings Class to MyWorldSettings_BP
7) Close and reopen the editor
If I missed a step or am doing something differently please include the steps you use to reproduce the crash. Additionally, please post the callstack and log files from the crash as well.
Are you on 4.9 ? It says 4.9 as the engine version in my original post.
Try switching your project to use the basic WorldSettings, restarting the editor, making the floor map, saving the floor map, restarting the editor, switching to the BP WorldSettings, restarting the editor again, and trying to open the floor map.
Basically your map needs to have a different actor class for WorldSettings (than the current project settings) for RepairWorldSettings to be called, and when the new WorldSettings is spawned, if it’s a BP, it crashes.
Nah, you can easily hack around it it by adding if (CurrentLevel->OwningWorld == nullptr) CurrentLevel->OwningWorld = PersistentLevel; right before the RepairWorldSettings call in UWorld::PostLoad(). I did that, resaved all my levels which had the wrong world settings, and then removed the hack.