# Array and structures

**URL:** <https://forums.unrealengine.com/t/array-and-structures/1262860>\
**Category:** Blueprint\
**Tags:** Structure, unreal-engine, Array, Blueprint, question\
**Created:** [August 16, 2023, 1:03pm UTC](https://forums.unrealengine.com/t/array-and-structures/1262860 "2023-08-16T13:03:20Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 21, 2023, 8:23am UTC](https://forums.unrealengine.com/t/array-and-structures/1262860/11 "2023-08-21T08:23:06Z")

</div>

> [@richarmearup](#):
>
> getting the **Move Component To** to work inside the **For Each Loop**

One cannot combine loops with latent nodes - note the clock icon on the `MoveComponenTo`.

My `MoveTo` is a custom event that lives inside another target actor (since each box was supposed be an actor, as in the original description I tried to adapt to - not guilty ;p ); meaning each actor has an instance of `MoveComponentTo’ which, once fired, can live its own independent life detached from what the loop is doing.

If you’re **not** working with box **actors** :

## Option 1:

- extend the `Static Mesh Component`:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/5/4/4545da538e26c7c221dcc895304d57e1ab27ad12.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/a/9/da937dc42675b8a7aae8bec86905f545a85e6622.png)

You’ll end up with a static mesh component that can handle a mesh asset, but can **also** host script and variables. I can’t stress enough how convenient this can be at times, and how well it keeps things low profile.

## Option 2:

Instead of trying to Move while the loop is looping, let the loop finish and add everything to a neat map as you do. When the loop has completed, fire a Timeline or Move Component To. But then you’ll need to handle data differently. Here’s an example:

> [@How to loop through different parts of a door blueprint smoothly?](https://forums.unrealengine.com/t/how-to-loop-through-different-parts-of-a-door-blueprint-smoothly/431075/3):
>
> You could also get a bit cheeky and use a vector for the Alpha value and split it, giving you the opportunity to move multiple objects simultaneously using just a single vector track: [[Image from Gyazo]](https://gyazo.com/c6e2b0cac670a0012d4f392a08f3b514) With each track you can control up to 3 additional elements. You could even combine this method with the re-usability suggestion from my first post but then it might be hard to read and debug. Still, beats 10 timelines. Good luck!

Ignore the track being a vector, you’d use a 0-1 float as alpha. Another example:

> [@Move multiple actors along spline](https://forums.unrealengine.com/t/move-multiple-actors-along-spline/437200/7):
>
> Here’s a simplified (compared to yours) script I’d use were I to push numerous actors along a spline: [[Image from Gyazo]](https://gyazo.com/cc07a1a805a8c28391c561dbac6e5380) Essentially, each car stores an offset. We animate another spline offset using a timeline, add both, and reposition the car. An optional Modulo wraps the value so we get perpetual motion.

Top bit prepares the data first, then a timeline moves multiple elements of an array.

There’s probably Option 3 & 4 out there that eludes me. Do tell how it goes. I’ll be around later this week.

---

_[View the full topic](https://forums.unrealengine.com/t/array-and-structures/1262860)._
