# UE 4.27 - Saving all actors of a type and their locations

**URL:** <https://forums.unrealengine.com/t/ue-4-27-saving-all-actors-of-a-type-and-their-locations/1526324>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [December 14, 2023, 10:45pm UTC](https://forums.unrealengine.com/t/ue-4-27-saving-all-actors-of-a-type-and-their-locations/1526324 "2023-12-14T22:45:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Mind-Brain](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mind-brain/32/906573_2.png) [@Mind-Brain](https://forums.unrealengine.com/u/Mind-Brain)\
**Post date:** [December 14, 2023, 11:19pm UTC](https://forums.unrealengine.com/t/ue-4-27-saving-all-actors-of-a-type-and-their-locations/1526324/2 "2023-12-14T23:19:05Z")

</div>

Hey @Bugbuh!

So what you will want to save is the transform of the enemies. That’s Location, Rotation, and Scale as one variable, just to make it easy.

So you’ll use GetAllActorsOfClass (or any other methods of getting them as an array) then on a ForEach loop, in the body of the loop use a “GetTransform” for the actor and add THAT to an array(or you can use a map). This will get the indexes to match 1:1 on both arrays.

Then when loading, when you spawn each member of the Enemy class, you’ll pull the index on your spawning ForEach loop, and for each Enemy Actor, SetTransform using that array you saved and the index from the spawning Enemy!

Saving current level as a variable would be based on the name of the level- check this thread for instructions on that. 🙂

> [@How to store level as variable?,How to save current level as variable?](https://forums.unrealengine.com/t/how-to-store-level-as-variable-how-to-save-current-level-as-variable/447735/3):
>
> You can store your levels as an integer variable in an “actor object” you place in each level. If you name each level (map) something like “LevelX” where “X” is a number then you can simply create an array of your level names, and use a get node with an integer for the level to select and open whatever level the player is on based on the integer variable saved to a save game object. Similar to this setup.

---

_[View the full topic](https://forums.unrealengine.com/t/ue-4-27-saving-all-actors-of-a-type-and-their-locations/1526324)._
