How to take a actor from 1 level to another level

So i have 2 levels. Level 1 and level 2 if i want to take a specific actor from level 1 to level 2 then when that actor in level 2 is destroyed go back to level 1 how would i overcome the bug of when i return to level 1 that actor is still alive even though i destroyed it

You need the save game.

Here’s how it goes;

  1. Pick up ( and destroy ) the actor in level 1. It’s much easier if that actor is a blueprint, because then it can write the fact that it got destroyed to the save game.

  2. Go to level 2

  3. When you start level 2, your player knows to read the save game to see if it was holding anything. Boom, it is, that actor. So, spawn that like you’re carrying it. Or put it down.

  4. Because this actor is, again, a BP, it can record the fact you put it down in level 2.

  5. Go back to level 1. The level starts, and the BP actor reads the save game and sees it was destroyed ( taken to level 2 ), so it destroys itself.

You might think that seems like a lot, but that’s how it works.

You might also get someone rabbiting on about the Game Instance. Yes, you can use that to do exactly this, but if you restart the game everything will be back to square 1, and you’ll need the save game AS WELL. So you might as well just use the save game…

:wink:

Thank you

1 Like

Ok im lost here a bit ive learnt how save game works but im having difficulty applying this to my own game if im in one level and i "destroy the actor " then save the game and go to level 2 how would that specific actor spawn in level 2

you can save the actor(s) status. If they are alive, the energy, weapon, bullets, all the relevant information…even using an array of structs if you have many actors…if a single actor just have a structure with relevant data (like energy, and important things), then when you open level 2 you just load the savegame , read the actor data, spawn it again and update its properties.
remember you can have all savegames you want…no just 1 savegame per game…you can have a myActorSaveGame file if you want…and is independent of overall savegame(hi scores, settings, whatever)

1 Like

The thing with the save game is, it’s entirely up to you how you use it, there’s no fixed way.

First of all, it’s much easier if the actors you’re destroying and recreating are blueprints. That way, they can keep track of themselves, you don’t need to have a level blueprint spaghetti trying to keep track of them.

When you click it ( or whatever you do to destroy it ), the BP puts stuff in the save game so it knows what to do in level 2, and THEN destroys itself.

Lets say your actors ( or BPs ) are just basic shapes with colors. I walk up to a green cube in level 1 and click it. The BP stores ‘green’, ‘cube’ in some arrays in the save game. One array is colors ( materials ), the other array is meshes ( a cube, here ).

Then you go to level 2.

You would need a blueprint actor in the level, that reads the save game when the level starts. It sees ‘ohh, green cube’ and spawns your blueprint again, makes it green, makes it a cube, puts it in the right place etc.

But it really depends on a LOT of things. Like what kinds of things ARE you sending from one level to another? Do you always send to the next level, or can you jump 3 levels? Etc…

This make alot of sense the things id be sending from one level to the 2nd level would be just the one actor i interacted with. So i guess i need to start learning arrays! Thanks for the help

1 Like

Ok ive done this the question is im using the get all actors class which limits me to 1 actor class is their a way to only get the actor that is overlapped and save that actor only.

Did I explain this to you before? Or was that someone else?.. :slight_smile:

nevermind i actually fixed it

1 Like