How to pass objects from one level to another

It’s probably really simple, but I can’t find a way to do it.

Basically I’ve got a level in which several objects are created. When something happens, I want the same objects, along with the player character, to transition to another level as they are. Is there a way do to this, or I have to manually put the objects in the level at compile time and then when I transition to that level I set their variables as they were in the previous level?

Seamless transition allows specifying a list of actors that will travel to the next level. I just don’t remember how exactly this list should be specified. It’s somewhere in AGameMode if I am not mistaken.

Thanks, that’s exactly the kind of thing I was looking for. I’ll look into that then!

I looked into seamless transitions (couldn’t find much on that actually, just snippets here and there; not well documented), but it seems to me that it’s a multiplayer-oriented solution. I couldn’t find anyone that used it in singleplayer, which is what I need. Maybe you can explain to me a little bit more if it can be used in singleplayer?

Also, I’ve seen that I could store data inside a UGameInstance and then recreate the objects with that data in the new level. I suppose that saving pointers inside the UGameInstance object isn’t an option since I assume that they get garbage collected, am I right?

You should be able to save your data in GameInstance. It persists(stays) throughout your whole game.
One solution would be to save the info in a struct and reconstruct the objects as you mentioned.

Not directly related, but don’t forget about USaveGame