# How do I get the location for each instance of a single actor within my level?

**URL:** <https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149>\
**Category:** Blueprint\
**Tags:** unreal-engine, saving, Blueprint, question\
**Created:** [October 10, 2024, 5:55pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149 "2024-10-10T17:55:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScoutAX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scoutax/32/973326_2.png) [@ScoutAX](https://forums.unrealengine.com/u/ScoutAX)\
**Post date:** [October 10, 2024, 5:55pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149/1 "2024-10-10T17:55:04Z")

</div>

Hello!  
Right now I am working on making a “reset” button for my puzzle game so the player can reset the puzzle if needed. I have a box item that I have several of in my level and I want to get the location of each one and store it so that when I reset the puzzle they go back to their original places.

As of right now I have this on the box item to get its location and save it

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/2/1/e21065c82e0dfe81d38579446e644b7e8783b39a.png)  
and I have this in my gamemode for when I reset the puzzle  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/e/e3e935b5779acf75651fc2ac6310874e3d1b857c.png)

The code I have now is causing the boxes to move from their original location on play and start falling from the sky for some reason. I’m not sure how I would go about getting the locations of each individual box or how to store it. I assume I should use an array but I’m relatively new to using blueprints and am not sure how to properly set one up.

---

<div class="post-metadata">

**Author:** ![AlienRenders](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienRenders](https://forums.unrealengine.com/u/AlienRenders)\
**Post date:** [October 10, 2024, 6:28pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149/2 "2024-10-10T18:28:31Z")

</div>

Do I understand correctly that you don’t really want to reset? You want to restore a save game so you can continue playing?

If so, then the issue I’m seeing is that you only have one box position in your SaveGame. You’ll need an array of vectors. If all your boxes are identical, then you’ll need to just spawn a box for each position. If the boxes are pre-existing, then you’ll just do a GetAllActorsOfClass, iterate over it with For Each node and then set the positions.

If I’m not mistaken, I think the teloport checkbox should be checked for setting positions.

As for falling, dunno. Maybe turn gravity off or check your collision settings.

edit: Also, it’s possible the boxes are falling because you’re moving them all to the same place and they’re colliding with each other so they have to go somewhere so they fall down. So it’s possible this resolves itself once you set each box to a different position.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 10, 2024, 6:58pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149/3 "2024-10-10T18:58:35Z")

</div>

It’s not resetting, because you just check the SG exists, but don’t read it 🙂

---

<div class="post-metadata">

**Author:** ![ScoutAX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scoutax/32/973326_2.png) [@ScoutAX](https://forums.unrealengine.com/u/ScoutAX)\
**Post date:** [October 10, 2024, 7:08pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149/4 "2024-10-10T19:08:26Z")

</div>

I realized this right after posting lol. I ended up finally finding a video where someone was trying to do something similar and got something working.  
Made a struct to store the class and location of each object and then put this code in my player controller to actually save the data

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/7/e/07e6167c576dda7a0b0a7dafcf0e1256f7726e65.png)  
The only downside to this is that when I load the data it doesn’t actually reset their locations, it just respawns them so I have to destroy them before I load the save  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/b/e5bf983e70c7f84f4a0cb62a96c940134e844aea.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 10, 2024, 7:18pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149/5 "2024-10-10T19:18:20Z")

</div>

Right, so you can try changing that spawn node to a ‘set actor transform’ node?

Something like that.

Trying to find a tutorial that does exactly what you want is hardly ever an easy job. You already know enough to get this done, I think;

Begin play  
Save positions  
Let player move objects  
Read positions  
Reset object positions

---

<div class="post-metadata">

**Author:** ![ScoutAX](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scoutax/32/973326_2.png) [@ScoutAX](https://forums.unrealengine.com/u/ScoutAX)\
**Post date:** [October 10, 2024, 7:20pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149/6 "2024-10-10T19:20:45Z")

</div>

Didn’t even notice I was using a spawn actor node. Been looking at this project too long lol. Thank you for pointing it out 🙂

---

<div class="post-metadata">

**Author:** ![usa423](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/usa423/32/918773_2.png) [@usa423](https://forums.unrealengine.com/u/usa423)\
**Post date:** [October 10, 2024, 10:05pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-location-for-each-instance-of-a-single-actor-within-my-level/2062149/7 "2024-10-10T22:05:15Z")

</div>

Ok so you mean actors dragged in that execute when the level executes VS actors SPAWNED in. If its dragged in actors you could get each reference from the level blueprint. Else when you spawn them I suppose you could set an OBJ variable inside perhaps the current game mode and store it there.
