# Can i use same widget through menu level and game level?

**URL:** <https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062>\
**Category:** Editor Scripting\
**Tags:** savegame, gameinstance, unreal-engine, level, Widget, question\
**Created:** [March 29, 2021, 5:09pm UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062 "2021-03-29T17:09:50Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [March 29, 2021, 5:09pm UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/1 "2021-03-29T17:09:50Z")

</div>

Hi,  
I am an amateur and i want to make a choice selection menu and deck selection menu (something like clash royal). I manage to do something like that (picture 1 and 2), but my question is :" How can I save images from a deck selected (which are 2d textures btw.) to spawn my object or mesh in a new level? or: Can I somehow when I’m in a new level see these images that I Drop on from the selected widget and spawn them in the game manually?" I saw some talented guy say: “This is user-independent and will mostly be found in GameMode, GameInstance, GameState and Player Controller.” ([https://answers.unrealengine.com/questions/424894/view.html](https://answers.unrealengine.com/questions/424894/view.html)).  
My gameinstance does not save selected images from the deck selection when i go in another level. In my GameInstance widget i use variable (2d texture) to save chosen images but I can t see them in another level. I am sorry for bad grammer and if it was dumb questions.

 ![1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/3/2/4327fe5d0645c297fa604fc091f3e38a4afa7046.jpeg)

![334049-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/b/2cb339ddb2e9a3bd3c2971f19fc04ebd8e313e32.jpeg)

---

<div class="post-metadata">

**Author:** ![KuroPhoenix7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KuroPhoenix7](https://forums.unrealengine.com/u/KuroPhoenix7)\
**Post date:** [March 30, 2021, 9:50am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/2 "2021-03-30T09:50:36Z")

</div>

Hi are you saving texture in gameinstance?

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [March 30, 2021, 10:12am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/3 "2021-03-30T10:12:20Z")

</div>

Well, I am trying to save texture in gameinstance so yes, but i dont know did i call him or not, because i dont see him in another level.

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [March 30, 2021, 10:18am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/4 "2021-03-30T10:18:25Z")

</div>

I was searching tutorial on youtube, but only variable i saw are integer, name, string. This one guy manage to save image but didnt say how([https://answers.unrealengine.com/questions/915625/how-do-you-save-texture2d-images-to-game-instance.html](https://answers.unrealengine.com/questions/915625/how-do-you-save-texture2d-images-to-game-instance.html))

---

<div class="post-metadata">

**Author:** ![KuroPhoenix7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KuroPhoenix7](https://forums.unrealengine.com/u/KuroPhoenix7)\
**Post date:** [March 30, 2021, 10:42am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/5 "2021-03-30T10:42:41Z")

</div>

Assuming you are using Blueprints and Have setup your custom game instance in project settings.

Create and variable inside Texture2D in GameInstance blueprint. Make sure it’s public and editable

call GetGameInstance in your blueprint cast it to custom GameInstance and set your variable with your texture.

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [March 30, 2021, 11:06am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/6 "2021-03-30T11:06:48Z")

</div>

Yes am using Blueprints and I change in setup my gameinstance with variable 2d texture. Do I need to put My gameinstance in choice selection menu widget or deck selection menu widget to call funktionality of saveing 2d texture?

---

<div class="post-metadata">

**Author:** ![KuroPhoenix7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KuroPhoenix7](https://forums.unrealengine.com/u/KuroPhoenix7)\
**Post date:** [March 30, 2021, 11:11am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/7 "2021-03-30T11:11:03Z")

</div>

In Project settings → Maps and Modes-\> Game Instance class  
you should set your game instance class there

no need to put game instance. You can access game instance from anywhere using getgameinstance method. just make sure to cast it to your custom game instance to use it

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [March 30, 2021, 3:59pm UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/8 "2021-03-30T15:59:38Z")

</div>

Okej, i did that in In Project settings → Maps and Modes-\> Game Instance class. Thats why i said i use in setup “mygameinstance”(this is my custom name for Game Instance class). Sorry if I didnt specified more clearly.

---

<div class="post-metadata">

**Author:** ![KuroPhoenix7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KuroPhoenix7](https://forums.unrealengine.com/u/KuroPhoenix7)\
**Post date:** [March 31, 2021, 5:02am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/9 "2021-03-31T05:02:42Z")

</div>

Variable needs to be Object type in GameInstance

 ![334177-screenshot-2021-03-31-103125.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/c/72c9f4efd461e0a2f409e44ec297dd5c28349389.png)

[User Widget Code][2]

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [March 31, 2021, 6:26pm UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/10 "2021-03-31T18:26:21Z")

</div>

i don’t know how to say this in best way but i hope this is enough  
THANK YOU 🙂 !!!

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [April 1, 2021, 6:43pm UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/11 "2021-04-01T18:43:45Z")

</div>

I don’t get it why?  
I paste it in widget whose main assignment is choice selection menu.

 ![334339-not-working.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/8/c28c2cde61f9c569f539cebad2ae0e0c81b0b873.jpeg)

---

<div class="post-metadata">

**Author:** ![KuroPhoenix7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KuroPhoenix7](https://forums.unrealengine.com/u/KuroPhoenix7)\
**Post date:** [April 5, 2021, 5:26am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/12 "2021-04-05T05:26:15Z")

</div>

You have created Texture Object as variable in Game Instance. Just change it to UObject Variable. Check my screen shot variable type is object

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [April 6, 2021, 7:32am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/13 "2021-04-06T07:32:11Z")

</div>

Yes, I change it to UObject Variable.

 ![334911-see.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/7/1a7e10f0cca6f927c8f55f6b6f83ef2fd807cb73.jpeg)

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [April 6, 2021, 7:42am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/14 "2021-04-06T07:42:47Z")

</div>

Still can’t connect them.

---

<div class="post-metadata">

**Author:** ![Poza1993](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Poza1993](https://forums.unrealengine.com/u/Poza1993)\
**Post date:** [April 6, 2021, 8:48am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/15 "2021-04-06T08:48:05Z")

</div>

How did you made this “set node” who needs to be connected with gameinstance and break slateBrush?

---

<div class="post-metadata">

**Author:** ![KuroPhoenix7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KuroPhoenix7](https://forums.unrealengine.com/u/KuroPhoenix7)\
**Post date:** [April 8, 2021, 5:40am UTC](https://forums.unrealengine.com/t/can-i-use-same-widget-through-menu-level-and-game-level/481062/16 "2021-04-08T05:40:34Z")

</div>

Just drag node from Game Instance and type the name of variable
