PreLoadMap triggers for other clients while in editor

I made a custom UGameInstance with C++, so that I could tell when the map begins loading. I attached my two functions to these events. When the events fire, I display a loading screen for a few seconds. It works good with the packaged game, but while in the editor, an event on one client causes it to trigger on all clients, even if they are not “connected”.

FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &UTwGameInstance::BeginLoadingScreen);
FCoreUObjectDelegates::PostLoadMap.AddUObject(this, &UTwGameInstance::EndLoadingScreen);

Is this expected? Is there a better way to add a “loading widget” before the player can see the world?

PS, i still need to know how to detect that the world has finished loading, and all the actors are in place.

Hey mgumley,

Could you provide some more information regarding this setup?

Specifically, I’d like to know which event is causing the loading screen to trigger on all clients.

As far as there being a better way to add a loading screen before the world is displayed, I would also use the method that you are using, so you seem to be on the right track as far as that.

As far as detecting if the world has finished loaded, if you’re using a level streaming setup (which I would recommend), you should be able to check IsLoaded to see if loading has completed.

Hi Sean,

Here’s my c++ code and blueprint. It may look unnecessary to check if the widget is already loaded, but if I don’t, I get the message “PIE:Warning: Warning The widget ‘load_screen_widget_C’ was already added to the screen.” This is a symptom of the bug I’m referring to. The clients seem to be sharing the same viewport memory space.

TwGameInstance.h:

	UCLASS()
	class FIGHT_PROJECT_API UTwGameInstance : public UGameInstance
	{
		GENERATED_BODY()	
	public:
		virtual void Init() override;
		UFUNCTION(BlueprintImplementableEvent)
			void BeginLoadingScreen(const FString& MapName);
		UFUNCTION(BlueprintImplementableEvent)
			void EndLoadingScreen();
	};

TwGameInstance.cpp:

	void UTwGameInstance::Init()
	{
		UGameInstance::Init();
		FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &UTwGameInstance::BeginLoadingScreen);
		FCoreUObjectDelegates::PostLoadMap.AddUObject(this, &UTwGameInstance::EndLoadingScreen);
	}

Thanks for the information. I’ve tested this setup in a clean project on my end, but I’m not seeing the same results.

Would you mind providing a project that showcases the issue so I can take a closer look at what I could be missing on my end?

Thank you for trying Sean. If you don’t mind I’ll wait until 4.15 is released and see if it’s still a problem.

That’s fine, feel free to leave a comment to reopen the thread if the issue still occurs in 4.15.