# Why is my Cast to Game Mode failing?

**URL:** <https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040>\
**Category:** Blueprint\
**Tags:** game-mode, unreal-engine, Blueprint, question\
**Created:** [August 4, 2014, 12:59am UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040 "2014-08-04T00:59:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![VigeoJames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@VigeoJames](https://forums.unrealengine.com/u/VigeoJames)\
**Post date:** [August 4, 2014, 12:59am UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/1 "2014-08-04T00:59:41Z")

</div>

I have an actor BP, that in the construction script it cast to the game mode. I have looked around but I cannot see why it is failing. Can you not cast to the game mode in the construction script of an actor?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_99e8ad321](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_99e8ad321](https://forums.unrealengine.com/u/anonymous_user_99e8ad321)\
**Post date:** [September 5, 2014, 8:06pm UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/2 "2014-09-05T20:06:39Z")

</div>

Hi, i have the same issue currently, from what i’ve learned so far the cast to game mode is failing:

Always on clients. They dont have a game mode object.

Always in ViewPortEditor

It works in either event graph or construction script on server, but will fail until you actually play the game. So it works in construction script but will not show/execute in editor. Use gamemodes for server logic only.

You can use GameStates to cast them as they do get replicated on clients.

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [September 5, 2014, 8:11pm UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/3 "2014-09-05T20:11:53Z")

</div>

GameMode is only present on the server. Also, the construction script runs in the editor too. There won’t be a GameMode in that case either. It’s only created when the game is started.

---

<div class="post-metadata">

**Author:** ![TorQueMoD](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/torquemod/32/710746_2.png) [@TorQueMoD](https://forums.unrealengine.com/u/TorQueMoD)\
**Post date:** [May 20, 2016, 6:07am UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/4 "2016-05-20T06:07:43Z")

</div>

That’s strange because there’s a tutorial on Digital Tutors that tells you to place code inside the game mode so you’d imagine that you’d be able to cast to it from another blueprint. I haven’t finished watching the series but I ran into the same issue when I was trying something outside the scope of the tutorial.

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [May 23, 2016, 2:37pm UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/5 "2016-05-23T14:37:48Z")

</div>

Yes, that’s correct. The GameMode is only valid on the server.

---

<div class="post-metadata">

**Author:** ![One\_Mode\_Only](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@One\_Mode\_Only](https://forums.unrealengine.com/u/One_Mode_Only)\
**Post date:** [May 9, 2017, 8:58pm UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/6 "2017-05-09T20:58:35Z")

</div>

I love seeing this echoed throughout a hundred answers without a single one actually helping to show _how_ to accomplish it. I’ve now read through the first page of Google’s results and see “GameMode is only valid on the server” over, and over, and **over**. Not once does anyone offer up any advice on how a client can get something from the GameMode. Even a simple example like setting an integer.

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [May 9, 2017, 9:00pm UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/7 "2017-05-09T21:00:55Z")

</div>

It’s impossible to do on the client. The game mode never exists there. If there’s something the client needs from it, it must be replicated from the GameState object.

---

<div class="post-metadata">

**Author:** ![Bossman602](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bossman602](https://forums.unrealengine.com/u/Bossman602)\
**Post date:** [February 17, 2023, 6:30pm UTC](https://forums.unrealengine.com/t/why-is-my-cast-to-game-mode-failing/290040/8 "2023-02-17T18:30:06Z")

</div>

Make sure your game mode is not overridden in the world settings.
