SpawnSlice as child of already existed Entity (rig helper)

I tried to catch just spawned slice on OnSliceInstantiated ebus event. but on this event m_metadataEntities do not have TransformComponent, so we can’t use SetParent() method.

how then we can make just spawed slice as an child of some entity ?

I found a way to make slice as child for some entity
there was 2 problems:

  1. metaEntities do not work for this at all, so instead this I use first spawned entity from fulldump spawned hierarchy

  2. m_entity->GetTransform() always equal null, moreover I find what this method is depricated

         * @deprecated Use the TransformBus to communicate with the TransformInterface.
        inline TransformInterface* GetTransform() const { return m_transform; }

so I use

AZ::TransformInterface* tm = AZ::TransformBus::FindFirstHandler(entities[0]->GetId());

it’s returns actual transformation interface

now my code for slice’s parenting looks like this

void InventoryComponent::OnSliceInstantiated(const AZ::Data::AssetId & sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress & sliceAddress)
	using namespace AzFramework;
	AZStd::vector<AZ::Entity*> entities = sliceAddress.second->GetInstantiated()->m_entities;

	if (entities.size() > 0) // work only with first root entity from slice, ignore childs
		if (entities[0])
			AZ::TransformInterface* tm = AZ::TransformBus::FindFirstHandler(entities[0]->GetId());

			if (tm)

			// Update character slot with actual spawned id
			m_characterEquipment[m_characterSlotEntity] = entities[0]->GetId();