# If I have a single actor in my level with a variable stored within it, how do I retrieve the variable efficiently?

**URL:** <https://forums.unrealengine.com/t/if-i-have-a-single-actor-in-my-level-with-a-variable-stored-within-it-how-do-i-retrieve-the-variable-efficiently/411690>\
**Category:** Editor Scripting\
**Tags:** Variable, value, actor, unreal-engine, cast, question\
**Created:** [December 7, 2017, 11:35pm UTC](https://forums.unrealengine.com/t/if-i-have-a-single-actor-in-my-level-with-a-variable-stored-within-it-how-do-i-retrieve-the-variable-efficiently/411690 "2017-12-07T23:35:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Generica](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Generica](https://forums.unrealengine.com/u/Generica)\
**Post date:** [December 7, 2017, 11:35pm UTC](https://forums.unrealengine.com/t/if-i-have-a-single-actor-in-my-level-with-a-variable-stored-within-it-how-do-i-retrieve-the-variable-efficiently/411690/1 "2017-12-07T23:35:54Z")

</div>

Hi. Currently Im using “Get all actors of class” every tick, and the node says to use it with caution since it is resource intensive. What is the way to go to get a value from my Tracker actor?

 ![222956-tracker.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/f/edfee98329ae9f8b24006135607ab9825873cde1.jpeg)

---

<div class="post-metadata">

**Author:** ![Syalen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syalen](https://forums.unrealengine.com/u/Syalen)\
**Post date:** [December 8, 2017, 2:15am UTC](https://forums.unrealengine.com/t/if-i-have-a-single-actor-in-my-level-with-a-variable-stored-within-it-how-do-i-retrieve-the-variable-efficiently/411690/2 "2017-12-08T02:15:27Z")

</div>

If your actor is in your level by default, you can access it directly in your level blueprint.  
If it isn’t, you can use GetAllActorsOfClass only one time (at the beginning), and store the result in a local variable. This way, you can access your actor whenever you want, with only one use of GetAllActorsOfClass.

---

<div class="post-metadata">

**Author:** ![Generica](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Generica](https://forums.unrealengine.com/u/Generica)\
**Post date:** [December 9, 2017, 10:55am UTC](https://forums.unrealengine.com/t/if-i-have-a-single-actor-in-my-level-with-a-variable-stored-within-it-how-do-i-retrieve-the-variable-efficiently/411690/3 "2017-12-09T10:55:47Z")

</div>

Thanks man. Worked out great
