Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to get a ULevelStreaming ref using onLevelLoaded/OnLevelShown delegates

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...

Product Version: UE 4.18
more ▼

asked Jun 21 '18 at 06:57 PM in C++ Programming

avatar image

108 4 5 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question