diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index 8c79a153c8..0672e02ff4 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -286,6 +286,30 @@ namespace O3DE::ProjectManager m_registration = pybind11::module::import("cmake.Tools.registration"); m_engineTemplate = pybind11::module::import("cmake.Tools.engine_template"); + // register the current engine if it isn't already + bool registerThis = true; + auto allEngines = m_registration.attr("get_engines")(); + if (pybind11::isinstance(allEngines)) + { + for (const auto& engine : allEngines) + { + AZ::IO::FixedMaxPath enginePath(Py_To_String(engine["path"])); + if (enginePath.Compare(m_enginePath) == 0) + { + registerThis = false; + break; + } + } + } + + if (registerThis) + { + auto registrationResult = m_registration.attr("register")(m_enginePath.c_str()); + + AZ_Error("ProjectManagerWindow", registrationResult.cast() == 0, + "Registration of this engine failed!"); + } + return result == 0 && !PyErr_Occurred(); } catch ([[maybe_unused]] const std::exception& e) {