If I’m not mistaken you can put a GetWorld check into the PlayerTick. the world should be nullptr
PlayerTick(...)
{
if(!GetWorld())
{
return;
}
// your code
}
If I’m not mistaken you can put a GetWorld check into the PlayerTick. the world should be nullptr
PlayerTick(...)
{
if(!GetWorld())
{
return;
}
// your code
}
My friend was making a PlayerController class and inside that class’s PlayerTick he put
if(GEngine != nullptr)
{
UGameViewportClient* gameViewport = GEngine->GameViewport;
check(gameViewport != nullptr); // TODO handle lack of gameViewport
//...
}
I wanted to test some functionality, so I created a child blueprint, but then the editor crashed. After a long search I found out that the PlayerTick method was called on BP creation and because the game wasn’t running there was no GameViewport so the check
macro was crashing the editor. Is it possible to somehow prevent this behaviour (other than removing the check)?
I already fixed it, now I’m just wondering why is it even called