# How can i get a variable from each actor in a world?

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-a-variable-from-each-actor-in-a-world/550989>\
**Category:** Blueprint\
**Tags:** variables, unreal-engine, Multiplayer, Widget, question, UE4-27\
**Created:** [May 7, 2022, 3:57am UTC](https://forums.unrealengine.com/t/how-can-i-get-a-variable-from-each-actor-in-a-world/550989 "2022-05-07T03:57:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fallerrr](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fallerrr/32/482685_2.png) [@Fallerrr](https://forums.unrealengine.com/u/Fallerrr)\
**Post date:** [May 7, 2022, 3:57am UTC](https://forums.unrealengine.com/t/how-can-i-get-a-variable-from-each-actor-in-a-world/550989/1 "2022-05-07T03:57:58Z")

</div>

So i already know about the get all actors of class node, but i don’t really understand the for each loop thing and i don’t know how i can get the same variable from each actor and use them separately. I hope i explained it well

---

<div class="post-metadata">

**Author:** ![uc\_ue2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uc\_ue2](https://forums.unrealengine.com/u/uc_ue2)\
**Post date:** [May 7, 2022, 9:29am UTC](https://forums.unrealengine.com/t/how-can-i-get-a-variable-from-each-actor-in-a-world/550989/2 "2022-05-07T09:29:37Z")

</div>

The for each loop lets you apply one operation for every actor it found, specified by the actor class. To get a variable from this your actor needs to have a variable created by you and it must be public or you can access variables that are inherited by the base class e.g. display name.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/6/6f601a34f551b85d1258644adea718069f118c2e.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/4/0d42b5c3b29394e2368af41a67cd51f04ff561a8.png)  
There are some good videos and tutorials available online which can guide you more to the concepts of blueprints and oop (object-oriented programming) which will help you a lot.  
e.g. [Blueprint Essentials: For Each Loop | 12 | v4.2 Tutorial Series | Unreal Engine - YouTube](https://www.youtube.com/watch?v=F-Ab8oS6YDU&ab_channel=UnrealEngine)  
or starting with BP essentials on [https://learn.unrealengine.com/](https://learn.unrealengine.com/)

---

<div class="post-metadata">

**Author:** ![Fallerrr](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fallerrr/32/482685_2.png) [@Fallerrr](https://forums.unrealengine.com/u/Fallerrr)\
**Post date:** [May 7, 2022, 6:32pm UTC](https://forums.unrealengine.com/t/how-can-i-get-a-variable-from-each-actor-in-a-world/550989/3 "2022-05-07T18:32:28Z")

</div>

thanks, i get it now
