# Setting Location of Multiple Actor Blueprints from Saved Vector Array?

**URL:** <https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113>\
**Category:** Blueprint\
**Tags:** unreal-engine, saving, multiple-instance, question\
**Created:** [March 31, 2020, 12:01pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113 "2020-03-31T12:01:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 12:01pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/1 "2020-03-31T12:01:19Z")

</div>

I have a Actor\_BP that allows me to set a mesh and pickup/ drop an object but I want to save the location of multiple objects without having to have a new blueprint for each object I want to move. I currently have a save system that works when there’s only instance of the BP in the level. I’ve set my Vector Variables to Vector Arrays but I cant’ figure out how to set each Instance of the object’s world location Independently. At the moment I load the save and all objects Spawn at the 1 saved vector and get launched into the air. I’ve look at documentation but I still cant piece it together.

The screenshots show my Save/Load Custom Events in the Pickup Objects Actor\_BP

---

<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:** [March 31, 2020, 12:31pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/2 "2020-03-31T12:31:02Z")

</div>

Yup, it’s because when you save the location, you make a one index array and overwrite the array you have in your savegame.

When you need instead of that code, is:

 ![298846-pickup.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/9/d19c2fdcdc86032252f3467f8b392ef093b4a9c2.jpeg)

and you need to put it in an actor OUTSIDE the object. The objects can’t save themselves ( well, they can, but it’s much easier to do it externally ).

So put this code in a standalone actor in the level, or in the level BP.

Then, when you went to restore, you read the array from the savegame and:

 ![298847-spawn.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/f/72f77890ec3b5736a57690c7628b7c00be5ad94f.jpeg)

Like that…

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 12:36pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/3 "2020-03-31T12:36:29Z")

</div>

This is very helpful and explains a lot. I’ll have a go at implementing this.

---

<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:** [March 31, 2020, 12:44pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/4 "2020-03-31T12:44:22Z")

</div>

Tell me how it goes 🙂

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 1:15pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/5 "2020-03-31T13:15:20Z")

</div>

In your example, where are you setting the location of the item for the array? At first I kept it in my ‘Pickup Items BP’ where it sets a Vector Array in my Game Instance which then set and saves another Vector Array in my save game. I then added the spawn actor portion to my level BP but It doesn’t seem to be setting any locations. I’m pretty that I’m just not setting the actor location in the right spot. Maybe I’m misunderstanding but I tried to set to actor location and add it to the array from my Level BP but I’m not sure how I’m suppose to get a reference to the Pickup Item BP in the level to get the location. I also created a empty actor in my level but I run into the same issue getting a reference to the items.

My apologies If I’m just being stupid…

---

<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:** [March 31, 2020, 1:52pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/6 "2020-03-31T13:52:14Z")

</div>

Let me check. You want to save the location of multiple pickup item blueprints?

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 1:55pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/7 "2020-03-31T13:55:47Z")

</div>

Yes, I have 1 BP that duplicated throughout the level.

---

<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:** [March 31, 2020, 2:06pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/8 "2020-03-31T14:06:55Z")

</div>

Right, do this in the level BP. ( I don’t know exactly what your slot name and actor names etc are, but you’ll get the idea ). First of all you need an easy way to get a reference to the save game:

 ![298873-check-reference.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/6/d/26d1a76931c75dba93d7f91609daf77709b3ee04.jpeg)

A custom event which saves the position of the pickup items:

 ![298876-save.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/e/0/5e0358cb16bde107dfe0bb806f877a1de85b0660.jpeg)

And an event to re-spawn them later:

 ![298875-spawn.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/8/0e8d9049b5859cd597b658374a56d7d9439d496a.jpeg)

That’s it.

EDIT: Just corrected the code for the save. The old code worked, but had a bit of a slip in it.

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 2:28pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/9 "2020-03-31T14:28:23Z")

</div>

Put everything in how it is in the images but I’m getting this error in the message log.

 ![298877-message-log-errors.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/5/2/c52b4623e9d8bc680ce3edac6c0cd918532fb73d.jpeg)

---

<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:** [March 31, 2020, 2:32pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/10 "2020-03-31T14:32:45Z")

</div>

I think you might have made a slip, can you show the code?..

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 2:39pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/11 "2020-03-31T14:39:30Z")

</div>

OK so the save reference:

 ![298878-save-game-ref.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/4/3c4164d14f30d15f739dae058514a9e9bba286b6.jpeg)

The saving location :

 ![298879-save-location.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/8/638d93fe65e7ceb9e231320611e8cf5eefaa6c78.jpeg)

And Loading the Items:

 ![298880-load-save.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/4/004495c0b11e5e9ff652a14ebb0d2a1f28b5eea5.jpeg)

---

<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:** [March 31, 2020, 2:47pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/12 "2020-03-31T14:47:15Z")

</div>

Ok, the code looks fine, I can only assume it’s something to do with those binds you have going on.

Try using keyboard strokes to trigger the save and load like this:

 ![298881-kb.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/0/e8012a40e73ba09d2450496ee0ab560d7a18397d.jpeg)

Remember to set ‘auto receive input’ to player 0 in the class defaults details.

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 2:51pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/13 "2020-03-31T14:51:24Z")

</div>

I’m getting the same errors using the keys  
Edit: I put some print strings at the end of both custom events. My loading event doesn’t pass the for each loop

---

<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:** [March 31, 2020, 3:01pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/14 "2020-03-31T15:01:51Z")

</div>

And the variable ‘save game’ is of type ‘BP\_savegame’ and your BP\_savegame has a vector array in it called ‘Pickup item location SG’?

And you’ve compiled it?

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 3:04pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/15 "2020-03-31T15:04:50Z")

</div>

Yeah, everything seems to be in working order. I added another print string to the save reference and its failed to cast to BP\_SaveGame.

---

<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:** [March 31, 2020, 3:07pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/16 "2020-03-31T15:07:46Z")

</div>

No idea I’m afraid. All I know is, it works fine here.

I can only suggest making sure absolutely nothing else is running and doing stuff to the save game.

When you get it working you need to a CLEAR on the save to the array, otherwise it gradually builds up a massive list of all the places the actors ever were 😉

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 3:11pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/17 "2020-03-31T15:11:53Z")

</div>

Ok I will add the clear to the save array. I’ll keep working on it, Thanks for the help.

---

<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:** [March 31, 2020, 3:17pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/18 "2020-03-31T15:17:04Z")

</div>

Yes, sorry. It’s acting as if the variable isn’t declared.

---

<div class="post-metadata">

**Author:** ![James\_M\_M](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James\_M\_M](https://forums.unrealengine.com/u/James_M_M)\
**Post date:** [March 31, 2020, 3:40pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/19 "2020-03-31T15:40:52Z")

</div>

Your comment about there being nothing else running the save game gave me an idea. I have the save set on my game instance for my characters variables so I put the save portion into the game instance and it works If I load the game without restart the level with the exception that the previous Item stay in the world. but when I load the level it forgets the location and just resets to the default location.

---

<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:** [March 31, 2020, 4:15pm UTC](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113/20 "2020-03-31T16:15:16Z")

</div>

Game instance isn’t persistent between loads, that’s what it’s for. So stuff you put in the game instance will not exist after you exit the game a reload.

I had another idea. Just make a new level, nothing going on except the grey platform. Put the code I gave you in the level BP.

Only trigger it with the keyboard.

PS: This is what happens when you don’t clear the array 😉

![298885-clear.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/1/d31eba6d0ac0cdcd5ceed2b84055e77f6646a339.gif)

( Started as 3 cubes… )

Also, if you fresh level idea doesn’t work, you can try a new project, that will DEFFO.

[Next page](https://forums.unrealengine.com/t/setting-location-of-multiple-actor-blueprints-from-saved-vector-array/463113.md?page=2)
