Download

save actor component array

Hi,

Have actor component that is attached to the actor. Then in the editor, when I select the actor from world outliner and then select actor component and then push the button from that component, it sets all the actors meshes to the array, that is in actor component. The problem is, that I can’t save the array. Every time I launch the game, the actor is empty after that. Or not empty, it has right length, but there is no reference to the meshes.

I tried to save it to the “save game” component, but no help. Any idea how to save the array even if I close the editor or launch the game?

Hi man,
Its not really clear, can you post a screenshot ?

i am pretty sure that you can save these reference in the editorr too without savegames,

So I have actor component that has function called “get all meshes” (function.png). It gets all the meshes from parent/owner actor and adds them to mesh component array.
Then if I go the the editor side and push the “get all meshes” (buttons.png), it will fill the array with meshes. It works! (the button doesn’t work when you open the parent actor to editor.
Then if launch the game and run custom event “explode_forward” (event_function.png) there is no reference to the meshes anymore, but the array has right length.

I hope this helps…

Hi man,
So,

1, you can “tempoary” fill the Mesh variables, using the construct event, and the game will see them, < ! but ! > when compiled ,the editor will reset them to editor settings, he will lose them.
2 while the variables are loaded, you can save them in a saveslot.
Even with the array completely empty , you can use the saveslot-reference-array to operate, (im setting a random Z for the wheels, and changing random color , yello or orange)

So the construct event use and set varialbes like “local” they work and are stored only for the session, but the session ends with every compile i think.

3, you can create an array in-game , but the array will remain empty in the editor until you run the game
4, You can create an array avaible in the editor, “Breaking” the array in smaller parts, that let you set and keep the information like in the image,

5 i am pretty confused on how create a direct reference to the components that are already inside the actor,
i always used the direct reference or the node get component by class https://docs.unrealengine.com/en-US/…***/index.html


EDIT:
The left column show how you can get the staticmesh and show them in the array, but is a temporary variable and get reset after compile.
In the middle column, save the reference on a saveslot, and even if the array in editor is emptu, you still can use the Load to get the references working.
On the right , an ingame Array, that will be filled in-ingame, so for now is empty,
And a workaround, , where you can break the array in variables that you can set and see inside the editor. always avaible.