Bugfixes to enable slice-to-prefab conversion to run with less warnings/errors/crashes (#768)

While trying to process all slices and levels in Automated Testing, a few bugs came up that needed to be addressed:
- [LYN-3832] TransformComponent had a field removed without updating the version number and converter, which caused a lot of excessive warnings
- SliceComponent would crash in debug builds on instantiation failures due to a null dereference that was guarded against in most but not all places
- SliceConverter now detects when nested slices exist and gracefully warns about it.
- InstanceUpdateExecutor / TemplateInstanceMapper will now immediately remove instances that are unregistered, so that any in the queue don't get processed on a subsequent tick.  This was causing crashes when the instance was destroyed before the processing occurred.  It also has a side benefit of preventing the same instance from executing multiple times.
- Minor logic bugfix to the pack close warning, the boolean check was flipped.

Also added an early-out on SetTemplateId, since this was causing some unnecessary instance queue entries.
This commit is contained in:
Mike Balfour
2021-05-17 14:58:18 -05:00
committed by GitHub
parent bade3229be
commit d084027b6e
8 changed files with 53 additions and 14 deletions
@@ -1740,7 +1740,10 @@ namespace AZ
if (!iter->IsInstantiated())
{
#if defined(AZ_ENABLE_TRACING)
Data::Asset<SliceAsset> thisAsset = Data::AssetManager::Instance().FindAsset(GetMyAsset()->GetId(), AZ::Data::AssetLoadBehavior::Default);
Data::Asset<SliceAsset> thisAsset = GetMyAsset()
? Data::Asset<SliceAsset>(Data::AssetManager::Instance().FindAsset(
GetMyAsset()->GetId(), AZ::Data::AssetLoadBehavior::Default))
: Data::Asset<SliceAsset>();
AZ_Warning("Slice", false, "Removing %d instances of slice asset %s from parent asset %s due to failed instantiation. "
"Saving parent asset will result in loss of slice data.",
iter->GetInstances().size(),