Hi Everyone.
I have an array of splines.
In one actor I set his position on spline 0, another actor is set on spline 1.
When I play in the editor and in standalone mode all actors are rightly positioned on their splines.
But when I package the game i find the actors on different splines. Why ? What can I do ?
This issue is getting me crazy.
How do you choose a spline for actors?
Hi.
I get all splines in my scene and I store that into an array. Then I get the spline I need and I assign that into a variable which my actor uses to follow the selected spline.
I have totally 4 splines in my scene.
In editor mode spline n°0 is one - spline n°1 is another one and go on.
In packaged game spline n°0 becomes what for example in the editor mode is spline n°4.
There’s clearly a misalignment in the index of the array from editor to game.
I can’t make animation which in editor mode works and in a packaged game gets a disaster.
That’s the problem. The Get All
node does not guarantee element order. It’s like selecting a random actor.
How do you actually decide which spline you want to start with? If you want a very specific one, use a tag. That’s providing you do not need a more complex comms setup.
- give that one actor instance (not BP) a tag:
- so you can:
Note this only works if there is, indeed, only one.
Sure. But I set the array as Instance editable.
So in the scene I set all splines which my actor needs in order of priority. But for some reason I can’t understand it works just in editor mode.
Get All does not guarantee element order. And the order in the editor is different than in packaged. The safest way to treat this is as a random selection:
And the best way to go about it is to never use this node if you do not intend to perform actions on ALL instances it returns. Or use this only where there is one:
But you’ve just overridden it here with the Get All node… Either do not override it if you set up the array manually or use a tag. There are other, more involved ways, too.
Perhaps I’m missing something:
The Locomotiva_Vesuvio
already has the carefully curated array, what’s the Get All
node for then? Use the array you made by hand.
I will try to delete “get” node in spline detetcion and use it when I need.
I can’t use that manually. Spline changes must takes place when my locomotive collides with a collision box. It has no sense to have an array which contains object in different order between editor and game. This make my work impossible. I need to assicure the same order in my array in editor and in game.
I do not follow… you literally did it manually here:
Just use this array. Do not override it with random order.
It has no sense to have an array which contains object in different order between editor and game. This make my work impossible.
They are not until you, yourself, override them with Get All actor of Class
here:
You cannot use this node to find actors in the world and expect order - if you do, you will need to sort the array. That’s why you should absolutely never ever use this node if you do not understand how it works…
It’s one of the worst & best things in the engine. It’s great because it’s easy and fast, and horrible when used wrong.
I know that I am the main reason of my issues becouse I am a 3D artist but not a programmer so I know that 90% of my issues its caused by myself. And I thank you very much for your assistance.
I used “get all actor of class” by following other tutorials to make possible an object follows one o more splines with the possibility to change that. Now I have this array and I used to order it manually as you seen becouse I thought in this way to sort all splines in a precise order so when I use “get” node ( 0, 1, 2, ect. ) I know what spline I use. This is the logic I used for and in Editor it works.