# Sorting a small array?

**URL:** <https://forums.unrealengine.com/t/sorting-a-small-array/1254603>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint\
**Created:** [August 8, 2023, 1:51pm UTC](https://forums.unrealengine.com/t/sorting-a-small-array/1254603 "2023-08-08T13:51:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![falkbeard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@falkbeard](https://forums.unrealengine.com/u/falkbeard)\
**Post date:** [August 8, 2023, 1:51pm UTC](https://forums.unrealengine.com/t/sorting-a-small-array/1254603/1 "2023-08-08T13:51:59Z")

</div>

I am using get all actors of class to gather all the bp’s (which are just duplicates in the scene) and using the position of those blueprints to switch camera positions.

I’ve discovered that the Get all Actors functions does not deliver a sorted array by default and is sometimes even different upon playing the project multiple times. Is there a way to sort an array after it’s collected? I’ve added tags to each BP in the scene (numbers 1-7) in the hopes I can but I feel i’m just searching around in the dark with no real logic to think of.

Any help on 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:** [August 8, 2023, 2:07pm UTC](https://forums.unrealengine.com/t/sorting-a-small-array/1254603/2 "2023-08-08T14:07:02Z")

</div>

You just can just make a function that finds the lowest tag

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/3/513787ad4aff5732ff0036c1876cded1cce85532.png)

( It’s less messy if you give the BPs and integer ID. Then at least it is an integer )

Then you can just keep finding the lowest

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/6/e86bd94d2f9061c3512e16881b83556fb0ccdfab.png)

---

<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 8, 2023, 2:52pm UTC](https://forums.unrealengine.com/t/sorting-a-small-array/1254603/3 "2023-08-08T14:52:08Z")

</div>

I’ll just leave it here:

> [@Sorting algorithms in Blueprints](https://forums.unrealengine.com/t/sorting-algorithms-in-blueprints/1135992):
>
> It is common knowledge that blueprints do not include sorting functions. In my previous experiences, I have been able to create simple sorting functions easily. However, during my current project, I faced the challenge of sorting large data arrays and found that the sorting process was either very slow or unsuccessful. Since I wanted to avoid using C++ code or third-party development, I independently researched this issue. After conducting some research, I have decided to share my findings in t…

Seems relevant.

---

<div class="post-metadata">

**Author:** ![falkbeard](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@falkbeard](https://forums.unrealengine.com/u/falkbeard)\
**Post date:** [August 10, 2023, 12:06pm UTC](https://forums.unrealengine.com/t/sorting-a-small-array/1254603/4 "2023-08-10T12:06:15Z")

</div>

Thanks for the replies guys! very informative.
