Different array element order in PIE and Build

Hi - you can’t rely on the ordering, you have to make it.

If the target point actor is a BP, you can put an int in it, if they’re just actors, you can set a tag with an int. Then grab the array and sort it by the int.

That way, you always know which order they’re coming in…

Hi, Thanks for the reply.

Can you elaborate how I can achieve this via direct communication? I don’t quite understand.
Images will be more than welcome!
More specifically - If I make variable of type Target Point array - it won’t let me set the reference actors in the widget BP.

327643-asd.jpg

Are they meshes or blueprints?

Hello everyone.

I’m having a difficult time working around my problem, and here it is:

I have a Widget BP that stores Target Point actors on Initialize . I then get their transform and set the character location to each of the target points respectively upon button click.
The problem is - It works perfectly in PIE while in build/standalone game it just breaks and teleports to the wrong locations. When I print the array element names I can see that the order changes in Standalone.
I do presume the array order based on the first actor created and then duplicated around the level. So the second actor in the array is the second Target Point duplicate, etc.

I’ve come to learn that there’s a different execution order in Build and PIE, but not sure if it’s related to me issue.

I tried storing the target points in play controller, game instance, game mode, nothing helps.

I’d like to learn of better, smarter ways of doing this, or just any fix.
Thanks!

I just use Target Point Actors ideally. but I created a BP of type Target Point with int variable “ID” - following your first reply. Still can’t get it right

I will get back shortly…

I literally just fixed it by naming the first Target Point actor from “Target Point” to “Target Point1” to help UE4 sort the order.

327657-asdasd.jpg

I literally just fixed it by renaming the first actor in the world outliner to be consistent with the numbers.

327657-asdasd.jpg

I changed the first Target Point from “Target Point” to “Target Point1”. Now UE4 knows the order.

-.-

That might work, but I don’t think it’s a guarantee.

I’ll come back ( had some stuff to do ) …

Alright thanks, looking forward to your solution.

Thanks a lot for your effort! I’ll do the same.

Ok. If you’re going to put the build anywhere remotely important, don’t rely on asset names :slight_smile:

This is how to get them by ID. So I made target point BPs. They’re just a target point with an ID:

You can set the ID in level:

Somewhere ( I did level BP ):

Function is a bit of a fiddle, posting that separately.

Function goes like this:

BUT: there are some things that need to be set. Two local variables:

327690-screenshot-5.jpg

One is just the found target point BP, the LowestID variable needs a default that is higher than you’ll ever use. I set this to 1000.

AND, the array coming in needs to be ‘by reference’ for it to work:

The end :slight_smile:

No worries - tell me if you get stuck…