# Question about "Global Variables".

**URL:** <https://forums.unrealengine.com/t/question-about-global-variables/2031632>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [September 21, 2024, 7:11pm UTC](https://forums.unrealengine.com/t/question-about-global-variables/2031632 "2024-09-21T19:11:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [September 21, 2024, 8:05pm UTC](https://forums.unrealengine.com/t/question-about-global-variables/2031632/2 "2024-09-21T20:05:25Z")

</div>

Hey there @ImagineTheEnding! So Unreal’s paradigms avoid things like global variables, as they have always been more work to maintain in the long run and worse when scaling games. I personally often recommend creating a new `GameInstance` and using that to hold your variables that you need to access globally.

`Gameinstance` are active and maintain data through the entire play session and you can access it from anywhere. This is often where I place saving/loading functionality and data for the session.

Nawrot’s setup over here is probably the closest simple way to keep a global that is maintainable, but it would still suffer from the scale issues if you end up needing more ways to manipulate that variable itself.

> [@How do you make 'Global' variables?](https://forums.unrealengine.com/t/how-do-you-make-global-variables/1840221/9):
>
> You can make functions in function library, and store that “Global” variable in game mode or game instance. First make bp game mode and your variable inside of it: variable declaration in BP\_Game\_Mode (create this blueprint based on game mode class, add variable) [my global variable] Second, make Blueprint Function Library. And make those 3 functions inside: Get Game mode (this is mainly to make SINGLE point/code in case you want to store those global variables elsewhere, also single poi…

Here’s also a video showing how to make a new `gameinstance` and create variables on it that might make the transition a bit clearer:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/f/34f8ae6d44e26a28b4c2a6c7631c96584a8c576b.jpeg "How to Create a Game Instance in Unreal Engine 5 - Carry Data Between Levels") ](https://www.youtube.com/watch?v=sWh1jgHb6Tw)

**Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.**

---

_[View the full topic](https://forums.unrealengine.com/t/question-about-global-variables/2031632)._
