GetSeamlessTravelActorList questions

Have a couple of questions. The first is, does the following use case make sense. We have a single player game that I would like to have one hidden actor stay alive. This would be to have a MetaSound that will persist through all levels. The only way I could see to have an actor stay alive would be to mimic a multiplayer game and use the GetSeamlessTravelActorList and have it persist through our transition map and on to the next.

Is this an appropriate (mis)use of the seamless travel actor?

If so, it is not working at the moment when I try to use it. The configuration is:

  1. Transition map is set in project settings, it has a default game mode that is simply a BP derived from GameModeBase with seamless travel enabled.
  2. The main GameMode I use for all other levels is a C++ class derived from GameMode with seamless travel enabled too.
  3. The actor to travel is created on the fly in the persistent level as indicated by the Level link under Window. Hovering over Persistent gives the tool tip that my MainMenu level is the persistent level (which is where this actor is dynamically spawned).
  4. I override GetSeamlessTravelActorList(…) in the normal GameMode and emplace the actor in question in ActorList and call the Super:: as follows:
void AMyGameMode::GetSeamlessTravelActorList(bool bToEntry,TArray< class AActor * > & ActorList) {
          ActorList.Emplace(GI->MyPersistentActor);  //this is an AActor* pointer
          Super::GetSeamlessTravelActorList(bToEntry, ActorList);
}

I have a log display in there that proves it’s being called, not shown for brevity. I check the pointer (Stored in a variable in GameInstance) in the level past my transition level and it is invalid, but more importantly, the Actor is not shown in the outliner so it’s pretty clear it’s not traveling and this isn’t just a case of iterating through the level to find it.

As a test, I placed a timer event in the traveling actor to report what level it’s in. It stops reporting when I move to the next level.

The questions here are:

  1. Am I misinterpreting how this is suppose to work?
  2. Do I need for my AGameModeBase to be a C++ Class and repeat this process within the transition level? (it is after all a simple BP derivation of AGameModeBase and thus is not overriding GetSeamlessTravelActorList() right now.

Thanks in advance

Edit: Near as I can tell, my actor doesn’t even make it into the transistion level based on displays.

Yeah, I would try creating a gamemode based on your AMyGameMode class and use that in your transition map… as you point out it runs that function when moving actors to your new level and your actor is skipped. Everything else you point out looks like your are doing correctly.

Thanks, helps to have some confirmation on something new (to me) like this. I’ll put the GetSeamless… in the other game mode too then. If that’s it, I’ll show resolved on your post. If not, I’m not quite sure what to try next!

One thing that concerns me is that my mainmenu level defaults to being the persistent level, and the docs (though convoluted because of missing words) say that the actor must be dynamically created in the persistent level to travel. Since I don’t explicitly set a persistent level, that remains a question.

I’m sorry, I didn’t read close enough. Maybe try attaching your sound manager to the GameInstance so that it persists, rather than an actor in the world? I’m not using MetaSounds so I’m not sure how they are instantiated or managed.

Now that would be a simpler solution by far. But GameInstance won’t accept an AudioComponent which is the only way I know to control a MetaSoundSource. If you think that’s possible, I’ll revisit. I assumed that it wasn’t in the hierarchy to permit components, but I didn’t actually look it up.

That may have been wishful thinking… I’m not sure to be honest. Just something that came to mind when I was re-reading your initial post. :slight_smile:

Here is a thread that talks about managing audio on the GameInstance:

Edit: A better discussion:

That will take a little studying but it almost looks too good to be true. Put the pointer in GameInstance and the AudioComponent won’t be destroyed and GC’d? That would be like magic, but it’s sure magic I’d love to have functional about now. I’ll try it and get back.

Seamless travel works in ue5? Last i checked it crashes the engine.

There is some real substance here. I obviously don’t have a functional solution or even a selection of the method, but your research gets me on the path, so I’ll call it resolved. I can still add the final method later. Thanks Very much.

1 Like

Great, 5.0 is still a little frontiersy. I’ll try this other method of making a persistent MetaSound / AudioComponent hooked to GameInstance. Thanks for letting me know that.

The method suggested here was a rousing success and the Seamless Travel is unnecessary for this application. Verbally, using GameInstance Event Init to Spawn 2d Sound set to be able to persist and not auto destroy, continues forever until the game stops. A MetaSoundSource is set as the asset in the Spawn 2d Sound and it’s pointer saved by doing a Set in BP on a C++ public variable in GameInstance of UAudioComponent*. From there, any other Actor in any other level may control it by the use of Execute Trigger and Set Parameter pulled off of that variable (pulled off of the Get Game Instance and Casting to the subclassed copy you’ve made.

note: this is not spawning a 2d sound, it’s just used to activate the MetaSound.

I can provide examples of how all this works if someone needs it. With the MetaSound included, it’s some pretty messy screen shots. But just showing the mechanics of the BP setup, including how to manipulate the Metasound in other levels, is pretty trivial.

1 Like