MCPcopy Create free account
hub / github.com/MothCocoon/FlowGraph / LogError

Method LogError

Source/Flow/Private/Nodes/FlowNodeBase.cpp:866–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864}
865
866void UFlowNodeBase::LogError(FString Message, const EFlowOnScreenMessageType OnScreenMessageType) const
867{
868#if !UE_BUILD_SHIPPING
869 if (BuildMessage(Message))
870 {
871 // OnScreen Message
872 if (OnScreenMessageType == EFlowOnScreenMessageType::Permanent)
873 {
874 if (UWorld* World = GetWorld())
875 {
876 if (UViewportStatsSubsystem* StatsSubsystem = World->GetSubsystem<UViewportStatsSubsystem>())
877 {
878 StatsSubsystem->AddDisplayDelegate([WeakThis = TWeakObjectPtr<const UFlowNodeBase>(this), Message](FText& OutText, FLinearColor& OutColor)
879 {
880 const UFlowNodeBase* ThisPtr = WeakThis.Get();
881 if (ThisPtr && ThisPtr->GetFlowNodeSelfOrOwner() && ThisPtr->GetFlowNodeSelfOrOwner()->GetActivationState() != EFlowNodeState::NeverActivated)
882 {
883 OutText = FText::FromString(Message);
884 OutColor = FLinearColor::Red;
885 return true;
886 }
887
888 return false;
889 });
890 }
891 }
892 }
893 else if (OnScreenMessageType == EFlowOnScreenMessageType::Temporary)
894 {
895 GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, Message);
896 }
897
898 // Output Log
899 UE_LOG(LogFlow, Error, TEXT("%s"), *Message);
900
901#if WITH_EDITOR
902 if (GEditor)
903 {
904 // Message Log
905 GetFlowAsset()->GetTemplateAsset()->LogError(Message, this);
906 }
907#endif
908 }
909#endif
910}
911
912void UFlowNodeBase::LogWarning(FString Message) const
913{

Calls 4

GetFlowAssetFunction · 0.85
GetMethod · 0.80
GetActivationStateMethod · 0.80

Tested by

no test coverage detected