[Feature Request] Allow sublevels to exist in multiple parent levels

Howdy,
Disclaimer: This might just be me misunderstanding best practices for this, so I’m also open to workarounds.

Anyway, would it be possible to allow levels to be included as sublevels on multiple parent levels? The use case I’m thinking of is that I want to have an ambient light and ambient sound level that I’d like to include in multiple different parent levels if possible, and that seems to cause huge issues with the current system because it looks like levels expect to only ever have one parent. Would it be possible to allow sublevels to exist in multiple levels?

The way I’m getting around this now is that I placed all my things and then did “Convert Selected Components to Blueprint Class”. I think that’s the current desired workflow for that, but I’m less confident that the behavior of that would be the same as a Level.

Any input appreciated :slight_smile:

Hi,

This workflow is supported and often used in our games. For example Map1.umap and Map2.umap can both include AmbientLight.umap as a sub-level. This works if both Map1 and Map2 used as a separate maps.

Sorry my comment got mangled so I’m rewriting it. There are a lot of bugs related to this when testing in the editor then.

A sublevel’s persistentlevel and that persistentlevel’s owningworld get corrupted when you perform a servertravel in editor between worlds that share the same sublevel. Sometimes assets don’t load, and the worst case scenario I’ve had is that the editor crashes the next time it tries to save when it’s moving the sublevel’s location to match up with the parent level.

My comment keeps getting mangled and won’t show up. :confused:

I think there are a lot of bugs in the editor related to this then. When I perform a server travel in the editor between two levels sharing the same sublevel, the sublevel’s actors seem to not load and when I leave the game the sublevel seems to be corrupted because the next time it saves it crashes the editor when it tries to move the sublevel to it’s parent’s location.

FWIW it crashes in Editor.cpp in the OnPreSaveWorld function when it does this because OwningWorld is null:

	// Move level position closer to world origin
	UWorld* OwningWorld = World->PersistentLevel->OwningWorld;
	if (OwningWorld->WorldComposition)
	{
		OwningWorld->WorldComposition->OnLevelPreSave(World->PersistentLevel);
	}

Could you provide steps how to reproduce this crash? OwningWorld should always exists when we save level in the Editor.

This is kind of a best guess set of steps, but out setup was kind of like this.

  • Sublevel with ambient lights
  • Level 1 with ambient sublevel and some way to ServerTravel to Level 2
  • Level 2 with ambient sublevel (this one is mostly procedurally generated for us, but I don’t know why that would cause an issue).

Steps:

  1. Save everything (works normally)
  2. Start Level 1.
  3. Trigger ServerTravel to Level 2.
  4. For us, once Level 2 is loaded, none of the lights from the ambient light level were loaded, but the ambient light level blueprint was loaded.
  5. Stop playing in editor.
  6. Try to restart the game triggering a save. This is where the crash happened when it attempted to save the ambient light level.

Let me know if there’s any more information I can give you, because if our ambient light level should be able to live in both levels that would be ideal for us too.

Thank you, that should be enough for repro.

Hiya,
Just curious if there’s been any progress on this.

Hey,

Was trying to repro it:
I have two maps (A and B) that share one same streaming level.

  1. PIE A and servertravel B - everything works fine, streaming level is loaded.
  2. Exit PIE and start PIE again, no crashes.

Did same steps with PIE as standalone game instead of viewport. still works fine. Is there anything I’m missing?

Hmm. I’m not sure. For the time being we just duplicated our ambient light level since we’re generating levels procedurally, so it wasn’t a big deal to add another level. It’s possible that something might get messed up when we generate our procedural level :confused:

I know we do build from source, so maybe something got messed up when we integrated too.

If I get a chance I’ll try moving the ambient back to the old way to see if I can get any more info. If I find anything new I’ll repost it here. Thanks for checking :slight_smile: