How do you call a level function from your PlayerController given that it's dynamcially instantiated?

All the examples I’ve seen for calling level functions uses event dispatching which requires a static reference to a blueprinted component that’s already in the scene. However PlayerControllers are dynamically instantiated and inserted into the scene so all the dispatcher examples are useless to me.

And why is the PlayerStart management in GameModes anyway? This doesn’t make sense to me. GameModes governs the entire game… but character spawning is very level specific.

Thanks for replying. I am migrating the PlayerStart management from one GameModes to the Level blueprint but it breaks me PlayerController because it can’t directly call a function on the level. This makes some sense to me because there’s no garantee that it will have access to that specific level.

But the design patterns that seem to suggest that PlayerStart management should happen inthe GameMode makes no sense to me. It is my understanding that the GameMode is persistent across the entire game regardless of what level you have. Having to accommodate the PlayerStart Management in every seperate level seems counter-intuitive.

Would PlayerStart management not be Level concern (and by extension level blueprint concern?)

I thought this seemed to be the right approach but I’m realizing that the PlayerController has no means of calling into the Level easily because all the example patterns for making calls into levels depends on static actors predefined in the scene.

You can assign event on dispacher call instad of using dispacher as event itselt.

Get player controller → cast it to your controller class → Assign event on (dispacher name) , this way will give u event when this dispacher will call, no mather if it will be now or later on.

So this is a multiplayer game?

Thanks for replying. I’m a bit of a noob still so I’m not quite following your statement.

Ultimately I have a Level function that I want my PlayerController to evoke (and I’d like to pass a reference of my player controller to this level function).

Now I imagine that it’s event driven so that if nothing recieves that event, it’s no harm no foul.

" Get player controller → cast it to your controller class → Assign event on (dispacher name) , this way will give u event when this dispacher will call, no mather if it will be now or later on."

I’m not sure what that would look like.

It is my understanding that the GameMode is persistent across the entire game regardless of what level you have.

Nope, your game mode is actually tied to each level. You can have a different game mode for each level if you want.

The only thing that is persistent across the entire game is the game instance class, as far as I know

Is that player specific?

No, it’s a global object

I’m struggling to find the best practice for player to store values between level transitions (an initial connection to a server apparently is unstreamed)

So it is a multiplayer game then. If you want to store player data you probably are gonna need a server sided database for your game, you wouldn’t store these values in the client since they could edit them. I’m not familiar with databases in unreal.

I try to put calls from the PlayerController to either the GameState or GameInstance depending on whether it’s something that effects only the level or the whole game.

Some things are obviously appropriate to be called on the Level. For that you need to use the EvenDispatcher.