How can this player controller client function get the gamemode?

This is some blueprint from Unreal’s multiplayer shootout demo which I’m trying to replicate in C++. How does this work?:

A client function called in the player controller class.

I thought that clients can’t get the gamemode, so “Get Game Mode” should fail. Why doesn’t it?

Edit: the link to the demo I’m talking about.

k, this confused the hell out of me for a second,
the answer is it doesn’t
Cast to MyGameMode fails and respawn player event is never called

the second player is just spawned over the default player spawn mechanic
try to disconnect the second player spawn in Respawn Player Event

and the second player is still spawned

Isn’t ClientPostLogin called on the Server side, from the Client?

Client post login isn’t an overridden function.

Huh… well that’s… weird. Guess there’s something else wrong with my project. Thanks!

actually, you’re right. that does feel weird. it’s calling a reliable server function inside gamemode, but since gamemode doesn’t exist on the client, how does that work?

Unless the event also fires on the server, then it doesn’t work – it’s dead code.

Start it, put a breakpoint there. I bet it either doesn’t fire, or it’s invoked on the server.

1 Like