# OnPostLogin executes before BeginPlay for server in multiplayer game mode. Is this expected behavior?

**URL:** <https://forums.unrealengine.com/t/onpostlogin-executes-before-beginplay-for-server-in-multiplayer-game-mode-is-this-expected-behavior/454140>\
**Category:** Multiplayer & Networking\
**Tags:** gamemode, Networking, Server, unreal-engine, Blueprint, question\
**Created:** [August 20, 2019, 3:49pm UTC](https://forums.unrealengine.com/t/onpostlogin-executes-before-beginplay-for-server-in-multiplayer-game-mode-is-this-expected-behavior/454140 "2019-08-20T15:49:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BladeMaster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BladeMaster](https://forums.unrealengine.com/u/BladeMaster)\
**Post date:** [August 20, 2019, 3:49pm UTC](https://forums.unrealengine.com/t/onpostlogin-executes-before-beginplay-for-server-in-multiplayer-game-mode-is-this-expected-behavior/454140/1 "2019-08-20T15:49:00Z")

</div>

Please see the question. Some screenshots:

BeginPlay in GameMode

![285443-ue4ss1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/2/f32f78673325742e21ed5b38f1ab731c714b7988.png)

OnPostLogin in GameMode

![285444-ue4ss2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/7/10710d1d957829ebb67c20ceb3db1a8961f0587d.png)

Output Log:

![285445-ue4ss3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/8/7/387c63dbdd726fedb123177661ce340dc2e4341f.png)

Is this expected? Shouldn’t BeginPlay always execute before OnPostLogin, even for the server?

---

<div class="post-metadata">

**Author:** ![APOCALIPSISXZ](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/apocalipsisxz/32/88718_2.png) [@APOCALIPSISXZ](https://forums.unrealengine.com/u/APOCALIPSISXZ)\
**Post date:** [October 12, 2022, 3:25pm UTC](https://forums.unrealengine.com/t/onpostlogin-executes-before-beginplay-for-server-in-multiplayer-game-mode-is-this-expected-behavior/454140/2 "2022-10-12T15:25:12Z")

</div>

This is so for the playercontroller of the server, the others (Clients) are executed after the BeginPlay

"AGameMode::PostLogin

Called after a successful login. **This is the first place it is safe to call replicated functions on the PlayerController**."

---

<div class="post-metadata">

**Author:** ![MeloinUnreal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MeloinUnreal](https://forums.unrealengine.com/u/MeloinUnreal)\
**Post date:** [May 6, 2024, 11:55am UTC](https://forums.unrealengine.com/t/onpostlogin-executes-before-beginplay-for-server-in-multiplayer-game-mode-is-this-expected-behavior/454140/3 "2024-05-06T11:55:54Z")

</div>

If somebody met this problem what you can do is to put all initialization logic not for begin play but for overriden InitGame function, so it will always be executed before PostLogin
