Help with saving destroyed actors

Hello all,

I have a project where the player can spawn an infinite number of actors and place them in the level where they want, I can save correctly where the player put the bjects, but I’mhaving a problem with the actors te player deleted. I save the placed actors in an array of actor, the position in an array of transform and the mat. in an mat. array, but with the deleted ones I’m with the problem, sometimes the game load the deleted actor and not load the actor that must be there, or load some actors on top of others. I tried using the “remove index”, but after the first index it always jump one, then I tried to use the “set array element” to none, but now I’m with this problem. Some hel eith this please

I too ran into this problem. The basic logic I came up with is that I can make a variable for whether an object is on or off, but this gets very heavy and tedious to program. I would basically have to maintain a list of what is on and what is off (or destroyed). That means though having a variable array for the objects that always remembers their state. i did this as a simple test, with one object and it worked but it seemed like a pain in the butt to maintain, and like something that would easily get broken in my scripts.

An alternative solution I came up with, and mind you my game doesn’t use an infinite number of actors, is instead of destroying my actors to put them in what i call the black hole. It’s a target that my object gets moved to when it is “destroyed” and thus it still has a location as 0,0,-10,000. Below my black hole is a huge plane to catch any dynamic objects that may be in motion and thus cause problems on reload of my game level.

Again though for my game we’re talking about maybe between 30-100 objects I toss in the black hole of doom for each level. Essentially it works because when i save a class it doesn’t care where the object is.

For you that is more difficult, although I wonder if as you have a player building a level you could implement something like this, and then pull “new” objects from the black hole where they can be recycled. A sort of video game recycling program, then only generate new objects if you used up everything in the black-hole.

wish i could offer more help on this, i feel like Save Game needs some tools and functions that we can use that are rock solid and dependable.

This is a great “sollution”, the problem I think is if the player decides to use 1000 objectos + the “deleted” ones, I’m making a mobile game, so I’m afraid it could get even slower (I’m having problem with the fps too, I don’t know what to do but I’m looking for options, my game is very simple and i still get low fps, I use only unlit objects in it), and the save game I need to study more, I discovered that I can Only save the game on the blueprint i created the “create save game”, and if i use this node in another blueprint, it will overwrite changes made by another BP, so I’m using my savegame node on the HUD class and every variable I need to save I’m puting there too

I built my Save Game into my “Persistent” game level. I say that in quotes because for most of the game it is persistent, not for load screens and some side levels. However, the idea was that I would build the save game system once (because re-setting up the variables and making sure everything was connected gets really laborious to repeat) and I have many many classes to iterate through.

To avoid saving over other areas of my game I’m using variables and the append function, seen below, to save to different files. So in the example below it will save to


WORDGM = wordgame

CLS_A_PK = the class of object I’m saving

LEV_AT = the level I’m streaming in, the puzzle pieces that need to always exist stay in the persistent for the entire game. Other things I don’t need to save are in m streaming level’s “Persist” level.

I do the reverse with loading when i return to a level, to insure that objects are in the right place where left.