Level streaming with different controllers

I’m using the level streaming system to display a loading screen in between the loading of my levels.
However, I can’t find a way to use different controllers for different levels while keeping the streaming system,
the controller stay loaded in between levels, and the level’s gamemode override don’t do anything, only the persistent level does.

I understand why it’s working this way and I get that it makes sense if you look at how the streaming system works,
but it is really unpractical and lead to messy code to have the same controller for ingame logic and main menu logic.

Is there a specific way you are supposed to handle this issue that I am not aware of ?

I was rummaging around and saw:


Maybe if you make the default game mode have no controller and use this? ( shot in the dark ).

Sadly, the player controller is supposed to represent a single player that has code to do anything the player may need to do at any given time. Because individual levels can have their own player controllers spawned and loading a new bespoke level destroys the current player controllers, people get the idea that player controllers are meant to be more modular (justifiably!).

So you have two options here: build all of the input logic into a single player controller OR create blueprint components to add to and remove from your player controller as needed. These components could be specific to menu handling or whatever, just destroy unnecessary components when adding new ones.

I haven’t tried this, but maybe you can switch game modes, spawn a new player controller then destroy the old one? But honestly seems like more trouble than just having two graphs in one controller :smiley:

The main problem is that I have a crapton of variables and references stored in my controller that are linked to object that exists in-game, but that I don’t need when in the main menu, and that are re-instanced when you re-load the main level again.

Basically, I would need to make a complex reset function for my Controller, and I figured just getting a new controller every time I load my level could be much easier and cleanier

Could you elaborate on blueprint components ? Do you just mean creating children of the component class and then putting my logic in it ?

Sure, you create a new blueprint class and have it inherit from Actor Component. Then you can add logic to it just like a regular blueprint class and add it to the base class’s list of components as your needs for different functionality change. See this video from Matt Wadstein that explains it concisely: Apologies if you are familiar with it already :smiley: