When I load a streamed level, the AWorldSettings::BeginPlay method seems to be called. This is very annoying when using it to create singleton-like objects to manage things for a specific maps with custom settings for each map.
I don’t know if this behavior is expected or not, I thinks there is an engine bug using world settings when level is loaded where it should not. If this is expected, it is very weird as world settings can be accessed in editor only for persistent level.
I’ve tested this by creating my own World Settings class and logging a message on BeginPlay() and then streaming in a level, but I’m not seeing the same results.
Would you mind providing me with a detailed list of repro steps I could use to reproduce the issue on my end?
It will be difficult for me to give you a detailed list of repro step, I use specific classes but I just create a UObject in World Settings Begin Play that I set in my game singleton class.
If it can help you I load my level with UGameplayStatics::LoadStreamLevel, creating a LatentActionInfo with an arbitrary UUID, all of this in C++ only.
I can try to log a message too in the begin play to see what happens
At this time, we do not believe that this is a bug with the engine.
After further testing, I was able to reproduce the issue; however, I believe that this is working as intended. Begin Play is called each time a level is loaded or has “begun play” and I would expect that it would be the same for World Settings.
I’d recommend looking into alternatives if this functionality is causing issues with your current setup.