# Where is it better to place the general logic of the game as a program?

**URL:** <https://forums.unrealengine.com/t/where-is-it-better-to-place-the-general-logic-of-the-game-as-a-program/480924>\
**Category:** Community & Industry Discussion\
**Tags:** gamemode, gameinstance, unreal-engine, fullscreen, question\
**Created:** [March 26, 2021, 4:36pm UTC](https://forums.unrealengine.com/t/where-is-it-better-to-place-the-general-logic-of-the-game-as-a-program/480924 "2021-03-26T16:36:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Al3ksam](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Al3ksam](https://forums.unrealengine.com/u/Al3ksam)\
**Post date:** [March 26, 2021, 4:36pm UTC](https://forums.unrealengine.com/t/where-is-it-better-to-place-the-general-logic-of-the-game-as-a-program/480924/1 "2021-03-26T16:36:22Z")

</div>

Hello! I have the logic of setting the fullscreen mode. Is it better to put this in GameMode or Game Instance?

GameMode

 ![333686-gamemode.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/d/c/fdc066993f56c5982d234e03654876d6b03c9740.png)

GameInstance

 ![333687-gameinstance.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/e/a/4ea986361288f26b6a7de35e1b265c8531195eaf.png)

---

<div class="post-metadata">

**Author:** ![Kehel18](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kehel18](https://forums.unrealengine.com/u/Kehel18)\
**Post date:** [March 26, 2021, 4:41pm UTC](https://forums.unrealengine.com/t/where-is-it-better-to-place-the-general-logic-of-the-game-as-a-program/480924/2 "2021-03-26T16:41:47Z")

</div>

Not sure, but I think that GameInstance is more global thing, while GameMode can be set differently for deifferent levels. Also I have seen several times that it is very handy to use GameInstance as Singletone.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 26, 2021, 7:45pm UTC](https://forums.unrealengine.com/t/where-is-it-better-to-place-the-general-logic-of-the-game-as-a-program/480924/3 "2021-03-26T19:45:15Z")

</div>

Game instance, or game state. They are both perpetual.

---

<div class="post-metadata">

**Author:** ![BamaGame](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BamaGame](https://forums.unrealengine.com/u/BamaGame)\
**Post date:** [March 27, 2021, 1:34am UTC](https://forums.unrealengine.com/t/where-is-it-better-to-place-the-general-logic-of-the-game-as-a-program/480924/4 "2021-03-27T01:34:40Z")

</div>

“Game Mode” depends on your level so you can have more than 1 Game Mode!  
so better to use in “Game Instance”

---

<div class="post-metadata">

**Author:** ![jhurtado2015](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jhurtado2015](https://forums.unrealengine.com/u/jhurtado2015)\
**Post date:** [March 27, 2021, 2:15am UTC](https://forums.unrealengine.com/t/where-is-it-better-to-place-the-general-logic-of-the-game-as-a-program/480924/5 "2021-03-27T02:15:36Z")

</div>

Both Game Mode and Game Instance will allow you to store and persist data of your game, however data in Game Mode will not be persistent across levels, this means when you level is unloaded data collected by the game mode will be destroyed, additionaly you might have multiple Game Modes and  
not necessarily you will use the same Game Mode in the next level. Game Instance is created once per application and destroyed at the end, if you need your data to be persistance across multiple levels then use Game Instance.
