I have a project where it has 1 NPC and 3 target points:
In the project I set the NPC to go to target point 1, then to 2, then to 3.
Path that is occurring:
This problem did not happen out of nowhere, but first I will explain the creation of the target points.
I created the first target point, added the components it needed, and then replicated it. Selecting the first target point and pressing CONTROL + W. I positioned the second target point, and then, again selecting the first target point, I again replicated it.
The order of the path was as expected. I modified some code (none of the codes I modified related to the NPC or target points). After that I created a new target point (replicating it from the first target point) and then my problem started.
The NPC was initially going to target point 3, to the 4, 1 and then 2.
Even excluding target point 4, the order did not return to the expected (1, 2 and 3).
I inserted a print after the loop that causes the NPC to move toward the target points, so I could figure out the order of the target points, and it is making sense with the order of the path that is taking place.
Blueprint + Print:
3 to 1 to 2.
I created 2 more target points, and see how the order changes without any sense:
4 to 5 to 1 to 2 to 3.
I added another 1 target point to see if it meets a pattern:
No sense at all.
I'd like to know how to set the order of target points in the array.
EDIT 1 (Root of the problem)
From what I researched, I came to the conclusion that the problem is due to the function Get All Actors Of Class (that I use to make the NPC follow the target point):
It was also researching that I discovered that I can search for a specific actor using tags.
Link where I made the discovery:
But this feature does not serve me, because I do not want to establish an exact number of target points, I would like the order of the path to be given by the name of the target points or at least by the creation order.
EDIT 2 (today opening the project again, the order is correct)
I suspected that if I added new target points, the problem would come back, but that was not what happened.
Again the order is correct:
Even so, I'd like you to tell me if there is any way to know all the elements of an array, and thus be able to treat, set, and order them. For this problem may occur again at some crucial moment.