From 5dcfb8e6542f858a31b04b090650ee3b55197900 Mon Sep 17 00:00:00 2001 From: srikappa-amzn Date: Wed, 8 Sep 2021 23:19:05 -0700 Subject: [PATCH] Initialize prefab interface pointers only when prefabs are enabled Signed-off-by: srikappa-amzn --- Code/Editor/CryEditDoc.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index 76704a3f07..a61429fc87 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -132,14 +132,19 @@ CCryEditDoc::CCryEditDoc() RegisterConsoleVariables(); MainWindow::instance()->GetActionManager()->RegisterActionHandler(ID_FILE_SAVE_AS, this, &CCryEditDoc::OnFileSaveAs); - m_prefabSystemComponentInterface = AZ::Interface::Get(); - AZ_Assert(m_prefabSystemComponentInterface, "PrefabSystemComponentInterface is not found."); - m_prefabEditorEntityOwnershipInterface = AZ::Interface::Get(); - AZ_Assert(m_prefabEditorEntityOwnershipInterface, "PrefabEditorEntityOwnershipInterface is not found."); - m_prefabLoaderInterface = AZ::Interface::Get(); - AZ_Assert(m_prefabLoaderInterface, "PrefabLoaderInterface is not found."); - m_prefabIntegrationInterface = AZ::Interface::Get(); - AZ_Assert(m_prefabIntegrationInterface, "PrefabIntegrationInterface is not found."); + bool isPrefabSystemEnabled = false; + AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled); + if (isPrefabSystemEnabled) + { + m_prefabSystemComponentInterface = AZ::Interface::Get(); + AZ_Assert(m_prefabSystemComponentInterface, "PrefabSystemComponentInterface is not found."); + m_prefabEditorEntityOwnershipInterface = AZ::Interface::Get(); + AZ_Assert(m_prefabEditorEntityOwnershipInterface, "PrefabEditorEntityOwnershipInterface is not found."); + m_prefabLoaderInterface = AZ::Interface::Get(); + AZ_Assert(m_prefabLoaderInterface, "PrefabLoaderInterface is not found."); + m_prefabIntegrationInterface = AZ::Interface::Get(); + AZ_Assert(m_prefabIntegrationInterface, "PrefabIntegrationInterface is not found."); + } } CCryEditDoc::~CCryEditDoc()