# TextBox content to integer variable in Level

**URL:** <https://forums.unrealengine.com/t/textbox-content-to-integer-variable-in-level/1716824>\
**Category:** Blueprint\
**Tags:** Variable, conversion, unreal-engine, UI, Widget, Blueprint, question\
**Created:** [February 27, 2024, 7:00pm UTC](https://forums.unrealengine.com/t/textbox-content-to-integer-variable-in-level/1716824 "2024-02-27T19:00:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![R\_smos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@R\_smos](https://forums.unrealengine.com/u/R_smos)\
**Post date:** [February 27, 2024, 7:00pm UTC](https://forums.unrealengine.com/t/textbox-content-to-integer-variable-in-level/1716824/1 "2024-02-27T19:00:49Z")

</div>

Good day, all of you!

I have a problem with the conversion of the text input by the player to a main menu at the start, then a new level is loaded with the text inputted by the player as a variable. When I run the program, it gives an error with Accessed None.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/e/f8e94389d638f93be8e7a4de018c356d16aa7c81.png)

See the blueprints.

This is the logic from the GameMode BP

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/2/5/f25e416ef891e7f750873a0cfa089ca8e65a457f.png)

This is the code for the Main\_Menu\_Widget

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/0/8204f87e906936b0673ff3c335642b7efcb73164.png)

Also the nodes from the Confirm\_Button

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/1/471c47ee111f0c6d84d8c8d690ff8778e0e81f35.png)

Can somebody help me in figuring out what I’m doing wrong?

Thank you so much in advance.

---

<div class="post-metadata">

**Author:** ![Arodi007](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arodi007/32/1022275_2.png) [@Arodi007](https://forums.unrealengine.com/u/Arodi007)\
**Post date:** [February 28, 2024, 8:38am UTC](https://forums.unrealengine.com/t/textbox-content-to-integer-variable-in-level/1716824/2 "2024-02-28T08:38:32Z")

</div>

GameMode doesnt persist when you switch level map.

so if you are accessing your menu widget in the begin play of your game mode(that you just open level map) it won’t exist yet.

You will need game instance where you can set/get your variable and it will persist through any level map across this game session.

---

<div class="post-metadata">

**Author:** ![R\_smos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@R\_smos](https://forums.unrealengine.com/u/R_smos)\
**Post date:** [February 28, 2024, 7:36pm UTC](https://forums.unrealengine.com/t/textbox-content-to-integer-variable-in-level/1716824/3 "2024-02-28T19:36:55Z")

</div>

Thank you for your reply!

I tried with an instance but still don’t get anything, even an error 😃

I changed the a little the GameMode

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/a/59a42e581e0fe92589f61193bfc73edc0ef759ca.png)

Got rid of the level change and made a Game\_Instance with a variable

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/1/52194c84bd58fdbe89a2316882d808af8ebd3b5e.png)

Also changed in the widget

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/2/0/b2055be4be8a0e57786cf392f4c3bfb3cd29df3e.png)

Still, the variable doesn’t seem to transfer.

What I’m doing incorrectly?

---

<div class="post-metadata">

**Author:** ![R\_smos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@R\_smos](https://forums.unrealengine.com/u/R_smos)\
**Post date:** [February 28, 2024, 8:02pm UTC](https://forums.unrealengine.com/t/textbox-content-to-integer-variable-in-level/1716824/4 "2024-02-28T20:02:47Z")

</div>

It worked, my friend. Thank you so much for your tip! Wish you all the best!

For the future strugglers

These are final nodes

From the widget

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/5/3/8533aec044922acc67210ca12cab9b8750661c68.png)

From the GameInstance

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/2/a/b2a7f0693b45e852184d455361d0d0f8f8f08f7e.png)

From ConfirmButton

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/9/3/193c066d813f660403f8d8dbf349b37019ae6afb.png)

From the GameMode

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/2/1f22afee07e3cb056178a4a297e8e108b0ba356f.png)

Hope it helps.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 29, 2024, 8:03pm UTC](https://forums.unrealengine.com/t/textbox-content-to-integer-variable-in-level/1716824/5 "2024-03-29T20:03:31Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
