Merge pull request #531 from aws-lumberyard-dev/LYN-3449

Cherry pick fix for editor crash on deleting slices with prefabs enabled
This commit is contained in:
srikappa-amzn
2021-05-04 09:35:33 -07:00
committed by GitHub
@@ -302,12 +302,15 @@ void SandboxIntegrationManager::OnCatalogAssetAdded(const AZ::Data::AssetId& ass
// operation writing to shared resource is queued on main thread.
void SandboxIntegrationManager::OnCatalogAssetRemoved(const AZ::Data::AssetId& assetId, const AZ::Data::AssetInfo& assetInfo)
{
bool isPrefabSystemEnabled = false;
AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled);
// Check to see if the removed slice asset has any instance in the level, then check if
// those dangling instances are directly under the root slice (not sub-slices). If yes,
// detach them and save necessary information so they can be restored when their slice asset
// comes back.
if (assetInfo.m_assetType == AZ::AzTypeInfo<AZ::SliceAsset>::Uuid())
if (!isPrefabSystemEnabled && assetInfo.m_assetType == AZ::AzTypeInfo<AZ::SliceAsset>::Uuid())
{
AZ::SliceComponent* rootSlice = nullptr;
AzToolsFramework::SliceEditorEntityOwnershipServiceRequestBus::BroadcastResult(rootSlice,