Hi devs, I’m making my first steps with UE4 C++.
Here’s me trying to spawn levels instances at runtime:
auto LevelStream1 = ULevelStreamingKismet::LoadLevelInstance(World, “Level01”, FVector(0,0,0), FRotator(0,0,0), &Success1);
auto LevelStream2 = ULevelStreamingKismet::LoadLevelInstance(World, “Level02”, FVector(100,100,0), FRotator(0,0,0), &Success2);
Then binding to OnLevelLoaded delegate, to know when my level will be ready for use:
LevelStream1->OnLevelLoaded.AddDynamic(this, &AMyClass::OnLevelInstanceLoaded); LevelStream2->OnLevelLoaded.AddDynamic(this, &AMyClass::OnLevelInstanceLoaded);
And finally my receiver function:
void AMyClass::OnLevelInstanceLoaded() { // do something with the Loaded Level // (???)how do I know which Level loaded? }
How do I know which Level is ready to be worked with?
Trying to access its pointers immediately after calling LoadLevelInstance() is pointless, since they are not yet initiliazed, so I really need to know if they are loaded or not.
Thanks to all
*please excuse any code error, I don’t have my code available now so I coded off the cuff…