GD2 Blog: Week 23

Collaborative Project

As of the 28th of March, I’ve worked a bit more on the collaborative project using Unreal Engine 4.

This time I decided to experiment with adding multiple checkpoints using an Array to store them all in, this is done by using an ActorIterator to search and loop over the following actors within the world.

Unreal has an in-built Actor Iterator that will loop over all actors in a given world.

Jamie Holding, 2020

For this, I created an actor that’d store all the following checkpoints within the level called a “SpawnPointManager”.

Within the private section of this actor’s header we include a TArray, which is a dynamic list that’ll be storing our spawn points (See Figure 1).

Figure 1

Using “EngineUtils.h” in the header file gives us access to our ActorTIterator that can be used to iterate the actors within the current level of a certain class (See Figure 2).

Figure 2

In our BeginPlay function, we start by having a pointer going towards the game world. This’ll give us access to using “GetWorld()” within our ActorIterator.

Figure 3

We then finally use the TActorIterator to search the world for Spawn Points, the iterator is done using a For Loop and is incremented with the ++ syntax to go towards the next entry (See Figure 4).

Figure 4

To access an entry, we create a pointer for each actor found within the loop by the iterator, we then check if the item we’ve found is NULL – this is to make sure the current item is defined and accessible. Once this step is done, the actor is added to our array (See Figure 5).

Figure 5

To test this array out, I created a function that we can use to select an actor from the array and destroy it – we’ll know if this works whether the selected checkpoint that gets deleted is a specific one.

Within this function, we first check if there are spawns present in the array we just stored our spawn points into with the first few lines of code – if this is equal to 0, we’ll simply return and not use the function.

However, if there are some spawns, we’ll set a pointer to the earliest placed spawnpoint within the level and delete it (See Figure 6).

Figure 6

Within editor view, we can see two spawnpoints placed next to eachother. The first one being our “SpawnPoint_BP” on the left, if this function were to work then it would destroy the spawnpoint on the left once the game starts (See Figure 7).

Figure 7

Once the game is set to play, our first spawnpoint should be destroyed as shown in Figure 8.

Figure 8

Setting our function to destroy the next number in the array should then destroy our second placed spawnpoint within the level as shown in Figure 9.

Figure 9

I feel as if I now have a basic understanding of how to use an array system to account for multiple of the same actors in Unreal. Although this was an experiment to try and learn arrays, I hope to plan on expanding on the checkpoint system using this same array system.


Holding, J., 2020. Unreal Engine 4 – Object & Actor Iterators. [online] Jamie Holding. Available at: [Accessed 10 April 2022].

Leave a Reply

Your email address will not be published. Required fields are marked *