From 43e6731714c6d93919d81d1a5088456a519a4ffc Mon Sep 17 00:00:00 2001 From: Sergey Pereslavtsev Date: Thu, 28 Oct 2021 15:17:11 +0100 Subject: [PATCH] Removed hierarchy validation since it is not always applicable Signed-off-by: Sergey Pereslavtsev --- .../Pipeline/NetworkPrefabProcessor.cpp | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp b/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp index 7e0e29030a..19d997b8d1 100644 --- a/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp +++ b/Gems/Multiplayer/Code/Source/Pipeline/NetworkPrefabProcessor.cpp @@ -105,41 +105,6 @@ namespace Multiplayer }); } - static bool HasNetHierarchyComponents(const AZ::Entity* entity) - { - return (entity->FindComponent() != nullptr) - || (entity->FindComponent() != nullptr); - } - - static void ValidateNetHierarchies(const AZStd::vector& prefabNetEntities) - { - AZStd::unordered_map prefabEntitesMap; - - for (auto* entity : prefabNetEntities) - { - auto* entityTransform = entity->FindComponent(); - AZ_Assert(entityTransform, "Net entities have to have Transform Component"); - - AZ::EntityId parentId = entityTransform->GetParentId(); - - // The input entities array is sorted in the parent to children order, - // so we only need to check against already iterated entities - if (parentId.IsValid() && prefabEntitesMap.contains(parentId)) - { - AZ::Entity* parentEntity = prefabEntitesMap[parentId]; - bool parentValid = HasNetHierarchyComponents(parentEntity); - AZ_Error("NetworkPrefabProcessor", parentValid, "Parent Entity %s must have a Network Hierarchy component assigned", - parentEntity->GetName().c_str()); - - bool childValid = HasNetHierarchyComponents(entity); - AZ_Error("NetworkPrefabProcessor", childValid, "Child Entity %s must have a Network Hierarchy component assigned", - entity->GetName().c_str()); - } - - prefabEntitesMap[entity->GetId()] = entity; - } - } - void NetworkPrefabProcessor::ProcessPrefab(PrefabProcessorContext& context, AZStd::string_view prefabName, PrefabDom& prefab, AZ::DataStream::StreamType serializationFormat) { using namespace AzToolsFramework::Prefab; @@ -178,9 +143,6 @@ namespace Multiplayer // Sort the entities prior to processing. The entities will end up in the net spawnable in this order. SpawnableUtils::SortEntitiesByTransformHierarchy(prefabNetEntities); - // Here we validate the hierarchical net entities have one of Network Hierarchy components. - ValidateNetHierarchies(prefabNetEntities); - // Create an asset for our future network spawnable: this allows us to put references to the asset in the components AZ::Data::Asset networkSpawnableAsset; networkSpawnableAsset.Create(networkSpawnable->GetId());