Updated NetworkSpawnableHolderComponent to use TransformBus instead of FindComponent. Added dependency on TransformService
Signed-off-by: pereslav <pereslav@amazon.com>
This commit is contained in:
@@ -24,6 +24,13 @@ namespace Multiplayer
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkSpawnableHolderComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
|
||||
{
|
||||
// TransformService isn't strictly required in this component (Identity transform will be used by default)
|
||||
// However we need to make sure if there's a component providing TransformService it is activated first.
|
||||
dependent.push_back(AZ_CRC_CE("TransformService"));
|
||||
}
|
||||
|
||||
NetworkSpawnableHolderComponent::NetworkSpawnableHolderComponent()
|
||||
{
|
||||
}
|
||||
@@ -37,13 +44,7 @@ namespace Multiplayer
|
||||
if(shouldSpawnNetEntities)
|
||||
{
|
||||
AZ::Transform rootEntityTransform = AZ::Transform::CreateIdentity();
|
||||
|
||||
AzFramework::TransformComponent* rootEntityTransformComponent =
|
||||
GetEntity()->FindComponent<AzFramework::TransformComponent>();
|
||||
if (rootEntityTransformComponent)
|
||||
{
|
||||
rootEntityTransform = rootEntityTransformComponent->GetWorldTM();
|
||||
}
|
||||
AZ::TransformBus::EventResult(rootEntityTransform, GetEntityId(), &AZ::TransformInterface::GetWorldTM);
|
||||
|
||||
INetworkEntityManager* networkEntityManager = GetNetworkEntityManager();
|
||||
AZ_Assert(networkEntityManager != nullptr,
|
||||
|
||||
Reference in New Issue
Block a user