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-06-07 04:56:02 +02:00
parent 16f520e54c
commit 1daeb8dbd7
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))
@@ -538,7 +538,13 @@ UWorld* FSGXRTracker::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))