Saving random properties of spawned actors to be respawned again with those properties.

Howdy,

I have an actor that’s a 12oz can. When it spawns, I want the mesh to be random, to represent the condition of the can (mint, crushed, etc.) The player can collect the can, putting it into an array. The player can later view the can. But the problem I’m running into, with the things I’ve tried, is that each time the player goes to look at the can again, it randomizes the mesh again.

There are many items in my game that spawn for the player to collect and look at, and they are set up in various arrays. All my actors have a Data Table Component, where a static mesh is assigned. I’m not sure how much that matters, but it might?

I’m guessing that when the player inspects the can later, you spawn a new one for them to look at?

Then it will randomizing again in consruction, or on begin play.

Presumably the player can pickup a can and change levels etc, which means you’ll need to keep the details in the save game anyway.

So when you regenerate the inventory item for them to inspect, you can read the details from the save game also.

You’re guessing correctly. My actors spawn and then when collected by the player, they go into an inventory array, and are then spawned from that when the player looks at them later.

I’m not sure how to save the details of spawned objects.

I do know how to set up save/load game stuff.

(I dove in to UE a year and a half ago, without any previous experience, so my knowledge level is still beginner I’d say.)

1 Like

You need to keep a record of whatever makes the item individual, material, mesh etc. Rather than storing these actual things in the save game, it’s much easier to have arrays of what the possibilities are, and only store the index.

Here’s something about save games