This is My Code,When I use Commandlet to enable it, it will crash if I compile a large number of blueprints. In fact, I know that it may be because I compiled animation blueprints or UMGs that cause the world to appear, but how do I solve it? It seems that I added garbage Recycling has no effect,and Trying to wait a minute has no effect
TSharedPtr ArtCheckLibrary::CheckAllBluePirnt()
{
double LastGCTime = FPlatformTime::Seconds();
TArray<FAssetData> AssetDataList = GetAssetDataListByClass(UBlueprint::StaticClass(), "/Game");
for (const FAssetData& AssetData : AssetDataList)
{
FString const AssetPath = AssetData.ObjectPath.ToString();
UE_LOG(LogTemp, Display, TEXT("Loading and Compiling: '%s'..."), *AssetPath);
// Load with LOAD_NoWarn and LOAD_DisableCompileOnLoad as we are covering those explicitly with CompileBlueprint errors.
UBlueprint* LoadedBlueprint = Cast<UBlueprint>(StaticLoadObject(AssetData.GetClass(), /*Outer =*/nullptr, *AssetPath, nullptr, LOAD_NoWarn | LOAD_DisableCompileOnLoad));
if (LoadedBlueprint == nullptr)
{
UE_LOG(LogTemp, Error, TEXT("Failed to Load : '%s'."), *AssetPath);
continue;
}
else
{
LoadandComplier(LoadedBlueprint);
}
const double TimeNow = FPlatformTime::Seconds();
if (TimeNow - LastGCTime >= 10.0)
{
GEngine->TrimMemory();
LastGCTime = TimeNow;
}
}
TSharedPtr<FJsonObject> TemplateDataObject = MakeShareable(new FJsonObject);
if (NumWarnings1+ NumErrors1+ OtherErrors1 ==0)
{
return nullptr;
}
TemplateDataObject->SetNumberField(TEXT("Warning"), this->NumWarnings1);
TemplateDataObject->SetNumberField(TEXT("Error"), this->NumErrors1+this->OtherErrors1);
TemplateDataObject->SetStringField(TEXT("DataInfo"), this->ErrorMessages1);
return TemplateDataObject;
}
void ArtCheckLibrary::LoadandComplier(UBlueprint *BlueprintAsset)
{
FCompilerResultsLog MessageLog;
MessageLog.SetSourcePath(BlueprintAsset->GetPathName());
MessageLog.BeginEvent(TEXT("Compile"));
// EBlueprintCompileOptions::SkipGarbageCollection
FKismetEditorUtilities::CompileBlueprint(BlueprintAsset, EBlueprintCompileOptions::SkipSave, &MessageLog);
MessageLog.EndEvent();
if ((MessageLog.NumErrors + MessageLog.NumWarnings) > 0)
{
this->AssetsWithErrorsOrWarnings1.Add(BlueprintAsset->GetPathName());
this->NumErrors1 += MessageLog.NumErrors;
this->NumWarnings1 += MessageLog.NumWarnings;
}
for (TSharedRef<class FTokenizedMessage>& Message : MessageLog.Messages)
{
EMessageSeverity::Type Severity = Message->GetSeverity();
if (Severity == EMessageSeverity::Error || Severity == EMessageSeverity::Warning)
{
FString LogContent = "";
LogContent += "**" + BlueprintAsset->GetPathName() + "** :";
LogContent += *Message->ToText().ToString();
ErrorMessages1 += LogContent + TEXT("\n");
/* UE_LOG(LogTemp, Display, TEXT("%s"), *Message->ToText().ToString());*/
}
}
}
that is my Crash report :Preformatted text16:14:22
16:14:22 Script Stack (0 frames):
16:14:22
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error: === Critical error: ===
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error:
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error: Assertion failed: bInitialized [File:F:/EngineTeam/EngineBuild/master/Engine/Source/Runtime/Engine/Private/Subsystems/WorldSubsystem.cpp] [Line: 68]
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error:
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error:
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error:
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error: [Callstack] 0x00007ffc50a3441c KERNELBASE.dll!UnknownFunction
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error: [Callstack] 0x00007ffbf120d006 UE4Editor-Core.dll!ReportAssert() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Core\Private\Windows\WindowsPlatformCrashContext.cpp:1620]
16:14:49 [2024.06.03-16.14.48:229][ 0]LogWindows: Error: [Callstack] 0x00007ffbf1210fd8 UE4Editor-Core.dll!FWindowsErrorOutputDevice::Serialize() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Core\Private\Windows\WindowsErrorOutputDevice.cpp:78]
16:14:49 [2024.06.03-16.14.48:230][ 0]LogWindows: Error: [Callstack] 0x00007ffbf0f630dd UE4Editor-Core.dll!FOutputDevice::LogfImpl() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Core\Private\Misc\OutputDevice.cpp:55]
16:14:49 [2024.06.03-16.14.48:230][ 0]LogWindows: Error: [Callstack] 0x00007ffbf0ea8a45 UE4Editor-Core.dll!AssertFailedImplV() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:102]
16:14:49 [2024.06.03-16.14.48:230][ 0]LogWindows: Error: [Callstack] 0x00007ffbf0eaaad0 UE4Editor-Core.dll!FDebug::CheckVerifyFailedImpl() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:457]
16:14:49 [2024.06.03-16.14.48:230][ 0]LogWindows: Error: [Callstack] 0x00007ffbed4e4e74 UE4Editor-Engine.dll!UTickableWorldSubsystem::Deinitialize() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Engine\Private\Subsystems\WorldSubsystem.cpp:68]
16:14:49 [2024.06.03-16.14.48:230][ 0]LogWindows: Error: [Callstack] 0x00007ffbed4e4d59 UE4Editor-Engine.dll!FSubsystemCollectionBase::Deinitialize() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Engine\Private\Subsystems\SubsystemCollection.cpp:154]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ffbed6d3bf9 UE4Editor-Engine.dll!UWorld::CleanupWorldInternal() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Engine\Private\World.cpp:4574]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ffbeaa04c5d UE4Editor-UnrealEd.dll!UEditorEngine::FinishDestroy() [F:\EngineTeam\EngineBuild\master\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1258]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ffbf2474ebc UE4Editor-CoreUObject.dll!UObject::ConditionalFinishDestroy() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1018]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ffbf22f4d9d UE4Editor-CoreUObject.dll!IncrementalDestroyGarbage() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp:1565]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ffbf22f594e UE4Editor-CoreUObject.dll!IncrementalPurgeGarbage() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\CoreUObject\Private\UObject\GarbageCollection.cpp:1489]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ffbf24a2585 UE4Editor-CoreUObject.dll!StaticExit() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:4526]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ffbf22e28b7 UE4Editor-CoreUObject.dll!TBaseStaticDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:704]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ff61435889d UE4Editor-Cmd.exe!TMulticastDelegate<void __cdecl(void),FDefaultDelegateUserPolicy>::Broadcast() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:955]
16:14:49 [2024.06.03-16.14.48:231][ 0]LogWindows: Error: [Callstack] 0x00007ff6143581ed UE4Editor-Cmd.exe!FEngineLoop::AppPreExit() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:5773]
16:14:49 [2024.06.03-16.14.48:232][ 0]LogWindows: Error: [Callstack] 0x00007ff6143604ca UE4Editor-Cmd.exe!FEngineLoop::Exit() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4237]
16:14:49 [2024.06.03-16.14.48:232][ 0]LogWindows: Error: [Callstack] 0x00007ff6143610a3 UE4Editor-Cmd.exe!GuardedMain() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Launch\Private\Launch.cpp:191]
16:14:49 [2024.06.03-16.14.48:232][ 0]LogWindows: Error: [Callstack] 0x00007ff6143610fa UE4Editor-Cmd.exe!GuardedMainWrapper() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:143]
16:14:49 [2024.06.03-16.14.48:232][ 0]LogWindows: Error: [Callstack] 0x00007ff61436411d UE4Editor-Cmd.exe!LaunchWindowsStartup() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:279]
16:14:49 [2024.06.03-16.14.48:232][ 0]LogWindows: Error: [Callstack] 0x00007ff6143754b4 UE4Editor-Cmd.exe!WinMain() [F:\EngineTeam\EngineBuild\master\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:326]
16:14:49 [2024.06.03-16.14.48:233][ 0]LogWindows: Error: [Callstack] 0x00007ff6143773e2 UE4Editor-Cmd.exe!__scrt_common_main_seh() [D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
16:14:49 [2024.06.03-16.14.48:233][ 0]LogWindows: Error: [Callstack] 0x00007ffc51e055a0 KERNEL32.DLL!UnknownFunction
16:14:49 [2024.06.03-16.14.48:233][ 0]LogWindows: Error: [Callstack] 0x00007ffc5338485b ntdll.dll!UnknownFunction
16:14:49 [2024.06.03-16.14.48:233][ 0]LogWindows: Error: