diff --git a/Code/LauncherUnified/Launcher.cpp b/Code/LauncherUnified/Launcher.cpp index 9dfd6213c4..7b681c5208 100644 --- a/Code/LauncherUnified/Launcher.cpp +++ b/Code/LauncherUnified/Launcher.cpp @@ -10,14 +10,17 @@ #include #include +#include +#include #include +#include #include #include #include -#include #include #include #include + #include #include #include @@ -571,6 +574,17 @@ namespace O3DELauncher } #if !defined(AZ_MONOLITHIC_BUILD) + + #if !defined(_RELEASE) + // until CrySystem can be removed (or made to be managed by the component application), + // we need to manually clear the BudgetTracker before CrySystem is unloaded so the Budget + // pointer(s) it has references to are cleared properly + if (auto budgetTracker = AZ::Interface::Get(); budgetTracker) + { + budgetTracker->Reset(); + } + #endif // !defined(_RELEASE) + delete systemInitParams.pSystem; crySystemLibrary.reset(nullptr); #endif // !defined(AZ_MONOLITHIC_BUILD)