How can I load/unload a sublevel(tile) in a world composition?
I want to load/unload tiles in a world composition called from a blutility function in editor mode (not ingame). In the picture below you can see the contextmenu for load/unload tiles. I want the same functionality via a blueprint function.
I tested UGameplayStatics::LoadStreamLevel / UGameplayStatics::UnloadStreamLevel in BlueprintFunctionLibrary in a sample project.
"LoadLevel" does work ingame but not in editor mode called from a blutility function.
"LoadLevelEditor" does not work at all and gives the error "LogLevel: Warning: Failed to find streaming level object associated with 'sub1'"
Is there any way to achieve the same result as clicking Load/Unload in the contextmenu?
You will need to look at using the functions:
If you are using them in C++, you may also need to add the header: #include "Kismet/GameplayStatics.h"
answered Feb 19 '19 at 04:13 PM
UGameplayStatics class is meant for runtime code. If you'd like to manage levels in the editor, you need EditorLevelUtils.
In my implementation, I keep an array of level names in the form of presets, so the user can easily switch between level presets. Then I retrieve ULevelStreaming* from the world (method in custom World Settings) and pass it to EditorLevelUtils methods.
This is ready snipper for you :)
Follow this question
Once you sign in you will be able to subscribe for any updates here