From 97bb921eeb14ac1ccb5909744fb8d816f16dd03d Mon Sep 17 00:00:00 2001 From: obitodaitu <389415860@qq.com> Date: Fri, 16 May 2025 10:04:12 +0800 Subject: [PATCH] 1.DrawPoint function must be in GameThread. --- Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp index 93b4f43fd..600f9034c 100644 --- a/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp +++ b/Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp @@ -110,11 +110,14 @@ void UAirBlueprintLib::DrawPoint(const UWorld* InWorld, FVector const& Position, { // this means foreground lines can't be persistent ULineBatchComponent* const LineBatcher = GetLineBatcher(InWorld, bPersistentLines, LifeTime, (DepthPriority == SDPG_Foreground)); - if (LineBatcher != NULL) - { - const float PointLifeTime = GetLineLifeTime(LineBatcher, LifeTime, bPersistentLines); - LineBatcher->DrawPoint(Position, Color.ReinterpretAsLinear(), Size, DepthPriority, PointLifeTime); - } + AsyncTask(ENamedThreads::GameThread, [LineBatcher, Position, Color, Size, DepthPriority, LifeTime, bPersistentLines]() + { + if (LineBatcher != NULL) + { + const float PointLifeTime = GetLineLifeTime(LineBatcher, LifeTime, bPersistentLines); + LineBatcher->DrawPoint(Position, Color.ReinterpretAsLinear(), Size, DepthPriority, PointLifeTime); + } + }); } }