BeginPlay of my Character class not being called on client of a listen server multiplayer project in ue5.1

Here’s the simple test:


I get one print, but I think there should be two, one as the client and one as the server. One with the “Server:” prefix that prints from the server automatically get.

The constructor is empty. The game mode and player state look good (I see no errors in the log), and if there was a problem there I wouldn’t expect the parent player class to work correctly (which it does). Same goes for the player controller.

Any ideas on how to narrow what the problem is?

What class is this you are showing? Only showing a print statement is meaningless, unless you give it a context :slight_smile:
If this the game mode class for example, you’d see only one print from the server, since the GM instance only exists on the server.

Edit:
On the other hand, a player controller exists on the owning client as well as on the server and therefore, the print statement should be executed from server and client.

That’s in my Player class. It’s on a project based off of Lyra so that print node is in B_Hero_ShooterMannequin, if you’re familiar with it.
Is it an Unreal 5 thing to not show the server print on a locally run listen server session? In the debugger I see the character with an added “B_Hero_ShooterMannequin0(Server, spawned)” specifier in parenthesis. Other than the print, is there another way of knowing if the client version is being run on the listen server?

you could try GetLocalRole() or GetRemoteRole(). I dont know how it is supposed to work on a listen server, bjt I guess it should only call once. On a dedicated server, which I use, there would be two prints. But since the listen server is also the client, I’d expect the print statement only once.

From my tests, it seems like on a listen server setup, the host is the same as the client so you only get one print output. This is disappointing because if I decide to switch to a dedicated server later, I have to go through all multiplayer code and make changes accordingly and add “is dedicated server” nodes with branches all over the place.

1 Like