fix the you are not the main thread and the editor is currently in a play mode errors

This commit is contained in:
Mamadou Babaei
2024-08-16 18:01:38 +02:00
parent 821215a78a
commit 0c7ccd9ed9
2 changed files with 14 additions and 2 deletions
@@ -128,7 +128,13 @@ UWorld* USGGloveTracker::FImpl::GetWorld()
}
}
if (!IsValid(World))
/// NOTE
/// IsInGameThread() check is to avoid EngineScriptHelpers::CheckIfInEditorAndPIE emitting:
/// "You are not on the main thread."
/// !(GEditor->PlayWorld || GIsPlayInEditorWorld) check is to avoid
/// EngineScriptHelpers::CheckIfInEditorAndPIE emitting:
/// The Editor is currently in a play mode.
if (!IsValid(World) && IsInGameThread() && !(GEditor->PlayWorld || GIsPlayInEditorWorld))
{
UUnrealEditorSubsystem* UnrealEditorSubsystem{GEditor->GetEditorSubsystem<UUnrealEditorSubsystem>()};
if (IsValid(UnrealEditorSubsystem))