Hi everyone :D,
I have a short question (or long).
I have now searched for hours and tested some code but I can’t find information about correct level streaming with C++.
What I want to do is:
I have 2 maps (“map1”, “map2”, “this” is a class derived from"AActor").
....
//sample code for used class
UClass()
class Test : public AActor {
.....
public:
void test();
....
}
At first I call:
//FLatentActionInfo isn't document well what it does and when, or I can't find enough information about it
UGameplayStatics::LoadStreamLevel(this, "map1", true, true, FLatentActionInfo())
Later ingame “ENTER” is pressed and I want to stream another level, as I had done it with blueprints before for testing.
UGameplayStatics::LoadStreamLevel(this, "map2", true, true, FLatentActionInfo())
UGameplayStatics::UnloadStreamLevel(this, "map1", FLatentActionInfo())
The first call loads the map correctly. The second call for “map2” loads also correctly but then the “map1” isn’t unloaded. The documentation says that the next call isn’t processed until the first call is finished (“Stream the level with the LevelName ; Calling again before it finishes has no effect.”).
The should be the point why “map1” isn’t unloaded because “map2” is currently loaded and not finished at this point.
I also tried to fill the FLatentActionInfo struct with
FLatentActionInfo info;
info.CallbackTarget=this;
info.ExecutionFunction="test";
info.UUID=12345;
and called
UGameplayStatics::LoadStreamLevel(this, "map1", true, true, info)
I expected that the callback is called if the loading operation was done but the method “test” is never called.
So I wondering about how I can achive it.
If anyone could explain this for me it would be really really great or have a short information which points in the correct direction.
Thank you in advance and have a nice day so far.
Regards
-freakxnet