As the subject says… it is only problematic when we are doing our things in C++. Ie in C++, GetWorld() returns null when the client cannot connect to server. Or should I open a level first?
Btw, in BP it is just straightforward - you can always execute openconsole (c++ ConsoleCommand) node even though no world is loaded. Seems so unfair lol. There must be something extra in BP that enable it do so.
Apologize if this sounds like a total noob question.
Probably in different class yes (I forgot to write that) but here in from within inherited UGameEngine. However day suddenly turn brighter and I have got the solution the minutes I posted this… lol… I guess this will work regardless of the class you are working on:-
UWorld* World = GEngine->GetWorldContexts()[0].World();
Glad it helps you.
I even forget that I solved this problem, and a look at my code… yes indeed I implemented it… lol.
One of the surest and best way to learn all this ‘quirks’ is by looking at the bp equivalent and double click where the corresponding UE4 c++ code will be revealed.