Game instance lose object on "Open level"

Hello. I have inherited instance class, at game start i am creating an actor and write its reference in instance.
Next i call “open level” and after that, i am lose actors reference, it becomes “not valid” and actor disappears from “world outliner”.

PS Yes i am set new instance in Map&Modes.

As i read, actors would always destroyed when “Non-seamless travel”.
So i am little confused, because i need an incapsulated data with own methods, actors\object is pretty good for this, but i cant transfer it thru level change.
And i cant use seamless travel, cause session creation.

Hello there, sorry for your misunderstanding.

Actors belong to the map. if the map is gone, they’re gone too. The only single class that exists beyond maps is the game instance, everything else will cease to exists the moment their map is unloaded.

If you’re using level streaming and you need your actor to cross maps, then place in the persisten level.

If you’re from one persisten level to another, you can’t carry over anything. You would have to fake it by storing anything relevant to that actors in the game instance and then recreating it in the new map.

Keep in mind games are all about smoke and mirrors. You’re always faking stuff that from the outside just looks right.

What you keep with seamless travel are the connections to the clients. but not the actors.

So there is no right way to make any global logic outside instance?
Recreating is not a way, because it much easier to make all variables and methods in instance from start and forget about transfering at all, than have an individual actor and additional methods\vars for transfer.

PS in seamless travel description, there are note about travel actor list, actors in that list able to travel between maps. I think it is what i needs, but there no way to use seamless travel in editor (without building execution file every time).

Ok, the solution is pretty simple, you just need UObject instead of AActor. UObject doesnt belong to level and may be transfered after the level change.

I am just create BP Class inherited from UObject, take ownership to instance and save reference. After “Open level”, object still “Valid”

1 Like

will have to try that one. the documentation never mentions it i think. and it makes sense. could come in handy!

Hello , I know this is an old post but it took my a whole week just to find this answer. Thank you for explaining :smiley: and have a good day!!!