# Cast to gamemmode always fails for client

**URL:** <https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721>\
**Category:** Blueprint\
**Tags:** casting, unreal-engine, Blueprint, question\
**Created:** [March 26, 2015, 6:24pm UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721 "2015-03-26T18:24:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![t0b4cc0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@t0b4cc0](https://forums.unrealengine.com/u/t0b4cc0)\
**Post date:** [March 26, 2015, 6:24pm UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721/1 "2015-03-26T18:24:25Z")

</div>

Hi!

Allright let me tell you what im doing:

1. start a session
2. join session with second instance of packaged game
3. start game with a servertravel (to a map that has a different gamemmode if that matters for this case)
4. in the gamemmode (MyGamemmode is set to default in the level that is being loaded) at begin play going through authority switch so only server does the stuff.

I “get player controller” cast to specific controller bp (that is default for the gamemmode that is the world override for the map so it should be loaded for all)  
Then I call an event that is in said player controller. The event (running “on owning client”) sets up the ingame UI (wich correctly works everytime) and then I cast to the specific gamemmode (MyGamemmode, the one where this event got called from) but the cast to gamemmode always fails.

Here in pictures:

[[Album] casttogamemmodefail ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/d/76d4feb208e7d0728e1aeb6a47d270d7310d6800.jpeg "casttogamemmodefail") ](https://imgur.com/a/JG2P5)

---

<div class="post-metadata">

**Author:** ![Spiris](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Spiris](https://forums.unrealengine.com/u/Spiris)\
**Post date:** [March 26, 2015, 7:15pm UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721/2 "2015-03-26T19:15:03Z")

</div>

removed: was not helpful or could be misleading

---

<div class="post-metadata">

**Author:** ![Justin.Dooley](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/justin.dooley/32/1194553_2.png) [@Justin.Dooley](https://forums.unrealengine.com/u/Justin.Dooley)\
**Post date:** [March 26, 2015, 8:41pm UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721/3 "2015-03-26T20:41:43Z")

</div>

GameMode is a server-only object. It is not replicated. I suggest you look into GameState instead.

---

<div class="post-metadata">

**Author:** ![t0b4cc0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@t0b4cc0](https://forums.unrealengine.com/u/t0b4cc0)\
**Post date:** [March 26, 2015, 9:44pm UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721/4 "2015-03-26T21:44:51Z")

</div>

yessss ty.

i just deleted the whole “cast” and call the respawn event in the gamemmode itself

---

<div class="post-metadata">

**Author:** ![t0b4cc0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@t0b4cc0](https://forums.unrealengine.com/u/t0b4cc0)\
**Post date:** [March 26, 2015, 9:46pm UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721/5 "2015-03-26T21:46:08Z")

</div>

no that was not the problem, problem was that clients can not cast to gamemmode

and btw creating a session can (now) be done per node

---

<div class="post-metadata">

**Author:** ![Jurif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jurif](https://forums.unrealengine.com/u/Jurif)\
**Post date:** [March 27, 2015, 11:40am UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721/6 "2015-03-27T11:40:51Z")

</div>

Yes in a multi player game only one GameMode exists and runs on the server ,  
GameState can be used instead. This video also explains GameInstance :

[![]( " - YouTube") ](https://www.youtube.com/watch?v=K_4CWDxwufg)

---

<div class="post-metadata">

**Author:** ![VIPMAY](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@VIPMAY](https://forums.unrealengine.com/u/VIPMAY)\
**Post date:** [December 27, 2019, 2:24pm UTC](https://forums.unrealengine.com/t/cast-to-gamemmode-always-fails-for-client/312721/7 "2019-12-27T14:24:14Z")

</div>

You should just do it all in one project with multiple levels. You can load levels via blueprints.  
Regards: [VIPMAY](https://www.vipmay.com)
