Get names of streaming levels in editor world?

Am I missing something, or are you restricted to doing stuff in the persistent level with editor utility scripts?

Now, the incredibly BAD thing is that when you get all actors of a certain class, you get ALL ACTORS FROM STREAMING LEVELS TOO!

That means that I must do this dance in order to filter the actors in the persistent level:

I can’t find any nodes that gets anything but the “current” level, so I hope I’m missing an entire section of streaming level node information here!

(My goal is to automatically set up portals for loading and unloading streaming levels, but it currently seems impossible since I can’t deduce what the level names of the found actors are in.)

I don’t know… I’m tearing my hair out here…

I think I solved it, but this is so dumb… :rofl:

And dear lord, this is how to get the level name that each actor is in… :man_facepalming:

I’m really, really hoping for Cunningham’s Law to kick into action now… :see_no_evil:

Now, here’s the really, really twisted thing:

The level name that an Editor Scripting Utility wants in order to switch level is NOT the same as the name you use to load a level in the game! (Editor Utilities want just the name itself, while an in-game level loading node wants the name with its complete path…)

The outer object of a “Level” is usually the World asset itself, so you could get the package name from the asset data (or do a split on the “Get Path Name”).

Also, you may want to use SetLevelVisibility/SetLevelsVisibility for editor operations:
image
image

The level name that an Editor Scripting Utility wants in order to switch level is NOT the same as the name you use to load a level in the game! (Editor Utilities want just the name itself, while an in-game level loading node wants the name with its complete path…)

Yeah, generally editor utilities will expect the asset name (rather than the full package name) since it expects the level to have already been added in the levels window (and that you’re just changing visibility states).

UE5 also has a BP exposed GetLevel call on actors, but in the meantime you can use this on an actor:
image

2 Likes

Thanks again for all the information!

I still think that editor utility widget nodes could be made more aware of persistent/streaming levels so you don’t have to build that functionality yourself, but I think I can at least reduce my graph sizes somewhat now. :slightly_smiling_face: