diff --git a/Code/CryEngine/CrySystem/SystemInit.cpp b/Code/CryEngine/CrySystem/SystemInit.cpp index 5e43d6a1df..77d4039052 100644 --- a/Code/CryEngine/CrySystem/SystemInit.cpp +++ b/Code/CryEngine/CrySystem/SystemInit.cpp @@ -4094,6 +4094,7 @@ void CSystem::CreateSystemVars() "0 = Suppress Asserts\n" "1 = Log Asserts\n" "2 = Show Assert Dialog\n" + "3 = Crashes the Application on Assert\n" "Note: when set to '0 = Suppress Asserts', assert expressions are still evaluated. To turn asserts into a no-op, undefine AZ_ENABLE_TRACING and recompile.", OnAssertLevelCvarChanged); CSystem::SetAssertLevel(defaultAssertValue); diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp index 18db84e326..635db26465 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp @@ -70,6 +70,7 @@ namespace AZ static const char* logVerbosityUID = "sys_LogLevel"; static const int assertLevel_log = 1; static const int assertLevel_nativeUI = 2; + static const int assertLevel_crash = 3; static const int logLevel_errorWarning = 1; static const int logLevel_full = 2; static AZ::EnvironmentVariable> g_ignoredAsserts; @@ -289,8 +290,8 @@ namespace AZ } #if AZ_ENABLE_TRACE_ASSERTS - //display native UI dialogs at verbosity level 2 or higher - if (currentLevel >= assertLevel_nativeUI) + //display native UI dialogs at verbosity level 2 + if (currentLevel == assertLevel_nativeUI) { AZ::NativeUI::AssertAction buttonResult; EBUS_EVENT_RESULT(buttonResult, AZ::NativeUI::NativeUIRequestBus, DisplayAssertDialog, dialogBoxText); @@ -314,7 +315,13 @@ namespace AZ break; } } + else #endif //AZ_ENABLE_TRACE_ASSERTS + // Crash the application directly at assert level 3 + if (currentLevel >= assertLevel_crash) + { + AZ_Crash(); + } } g_alreadyHandlingAssertOrFatal = false; } diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp index c157189400..6a00990ffa 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp +++ b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp @@ -539,8 +539,8 @@ namespace ImGui { int assertLevelValue = gAssertLevelCVAR->GetIVal(); int dragIntVal = assertLevelValue; - ImGui::Text("sys_asserts: %d ( 0-off | 1-log | 2-popup )", assertLevelValue); - ImGui::SliderInt("##sys_asserts", &dragIntVal, 0, 2); + ImGui::Text("sys_asserts: %d ( 0-off | 1-log | 2-popup | 3-crash )", assertLevelValue); + ImGui::SliderInt("##sys_asserts", &dragIntVal, 0, 3); if (dragIntVal != assertLevelValue) { gAssertLevelCVAR->Set(dragIntVal);