# Get Game Mode variables from widget

**URL:** <https://forums.unrealengine.com/t/get-game-mode-variables-from-widget/896722>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Widget, CPP, Blueprint, question\
**Created:** [April 12, 2023, 6:40pm UTC](https://forums.unrealengine.com/t/get-game-mode-variables-from-widget/896722 "2023-04-12T18:40:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nechalon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nechalon/32/967402_2.png) [@Nechalon](https://forums.unrealengine.com/u/Nechalon)\
**Post date:** [April 12, 2023, 6:40pm UTC](https://forums.unrealengine.com/t/get-game-mode-variables-from-widget/896722/1 "2023-04-12T18:40:41Z")

</div>

If the game mode is only server based, then how can I get the variables from the game mode in a widget? Do I need to do it from game state? Is that the only way to go?

I have some game types (names like “Capture The Flag, Domination”) in the game mode, and I want to display that in the widget, and casting to the game mode in the widget always fails, because it is server sided.

---

<div class="post-metadata">

**Author:** ![Nechalon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nechalon/32/967402_2.png) [@Nechalon](https://forums.unrealengine.com/u/Nechalon)\
**Post date:** [April 12, 2023, 6:51pm UTC](https://forums.unrealengine.com/t/get-game-mode-variables-from-widget/896722/2 "2023-04-12T18:51:57Z")

</div>

hmm, it looks like that the problem was that I was casting to a game mode that the level was not using. I created the array in the game mode that the level was using, and now the cast is valid!
