How to see/modify the actors' indexes?

Hello! I have a problem. I was using “empty” actors to turn them into Spawn Points for my AI. Indeed, at the beginning of the level, I defined in Arrays the index of the Spawn Point in which my AI should appear, but also which specific AI appeared. I didn’t have a problem so far, but now the indexes of my Spawn Points are completely different from before. I don’t know why. How did I place my Spawn Points? It’s very simple. I first put a “Spawn Point”, an empty actor (it then had the index 0). Then I duplicated it and put its copy elsewhere in my level (this one therefore has index 1). I then put a TextRenderActor above each point so as not to get lost. So I would like to know how I can see/modify the indexes of each of my Spawn Points directly in the Editor. Maybe I should have done this with Tags? If yes, how? Thank you in advance.

Get All Actors of Class will return the array of the actors in the order they were placed in the level. So if you place Spawn Point 0, then Spawn Point 1, then Spawn Point 2, and then delete Spawn Point 1 and place another one, in the world outliner it will be called “Spawn Point 1”, but the array order will be [0, 2, 1] now.

I’d do it as follows:

  1. In the Spawn Point BP, add an Int variable called “Index”, expose it for edit in viewport.
  2. When you add a spawn point into the level, manually set a new index for it. Here, to improve your workflow, you can add some functions in the construction script, e.g. the spawn point may check if any of the other spawn points has the same index, and warn you about it somehow; and you can create the text render as the component of the Spawn Point BP, and change it automatically.
  3. Spawn your AIs based on the Index variable.

It might seem to be a bit less efficient than working with the array indices directly, but this gives you more control and you can be sure that the indices are always the same.

The problem is, get all actors doesn’t say anything about what order the items are collected in.

Because they’re blueprints you just need to make sure they have ID variables:

Then you can find out which is which like this:

In fact, why not just put the spawn class in a variable there:

308723-class.jpg

Then you can say:

Hi! Thx for your answer! However I found an easy solution for what I wanted. I just used tags tagged the same way as my indexes should have been. So I didn’t have to change a lot my blueprint:

Thx for your answer! However, as I didn’t find IDs (I don’t know why you have them on your actors), I used actor tags. And I tagged them the same number as their index should have been. Thus I didn’t have to change a lot my BP:

You put the IDs on them…