# How to get variable by name?

**URL:** <https://forums.unrealengine.com/t/how-to-get-variable-by-name/1196173>\
**Category:** Blueprint\
**Tags:** variables, Variable, unreal-engine, question, Blueprint\
**Created:** [June 11, 2023, 8:16pm UTC](https://forums.unrealengine.com/t/how-to-get-variable-by-name/1196173 "2023-06-11T20:16:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Texn0krat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Texn0krat](https://forums.unrealengine.com/u/Texn0krat)\
**Post date:** [June 11, 2023, 8:16pm UTC](https://forums.unrealengine.com/t/how-to-get-variable-by-name/1196173/1 "2023-06-11T20:16:53Z")

</div>

Hello. I’m trying to connect my enum with character’s parameters like strength, agility, etc.  
I’ve created enum:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/7/1c7b40c283d2ba33acbc28904141b071bc7a8259.png)  
and trying to connect it to variables from my gameinstance:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/0/9f09a5998b6252bda0d8f77bf4f535107d932c52.png)  
in function:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/a/1ca9ebc85c4801390025aa88de36ce9685fa1279.png)  
The problem is I don’t have that function. The only way I know is to create that:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/3/0/83032a57b269366d02a29fea719dc661dda74054.png)  
but I have TOO MUCH parameters to do it.

I’m using blueprints only, tried to watch that video:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/a/4/ca40a7e3bbb0ffccd57ec72e79f4d1883af4bb06.jpeg "UE4 get variable by name with Blueprints and c++") ](https://www.youtube.com/watch?v=VvRqJTocTfw)

but author is using c++ to create user library and to use it in blueprint.  
Can you help me?

---

<div class="post-metadata">

**Author:** ![Extrone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/extrone/32/906554_2.png) [@Extrone](https://forums.unrealengine.com/u/Extrone)\
**Post date:** [June 11, 2023, 8:21pm UTC](https://forums.unrealengine.com/t/how-to-get-variable-by-name/1196173/2 "2023-06-11T20:21:55Z")

</div>

Use a Map variable instead with the Enum as the Key and int32 as the Value.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/b/4/9b4fa13ca89de3cc42db4ef63194dc2a57af6c05.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/5/635ad0e3ea160876b68c59d6efccac5a4b073379.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/e/cdeb887a33ee8f8210161cb4990c0c25a8831999.png)

Then you can use the Find and Add nodes to get and set the values.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/2/d2218837a28a41e66a1b978c16e0fa4dfaa7ec62.png)  
Add node adds the enum to the map if it doesn’t already have it. If it already has it, it’ll just replace the value.

---

<div class="post-metadata">

**Author:** ![Texn0krat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Texn0krat](https://forums.unrealengine.com/u/Texn0krat)\
**Post date:** [June 11, 2023, 8:55pm UTC](https://forums.unrealengine.com/t/how-to-get-variable-by-name/1196173/3 "2023-06-11T20:55:05Z")

</div>

Oh, very interesting solution, thank you! I’ll try this.

---

<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:** [July 11, 2023, 8:55pm UTC](https://forums.unrealengine.com/t/how-to-get-variable-by-name/1196173/4 "2023-07-11T20:55:22Z")

</div>

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