Fix prefab apply bug when one of the prefabs in project is broken
This commit is contained in:
@@ -675,20 +675,12 @@ bool Prefab::ApplyAll(Actor* targetActor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup default instances
|
// Setup default instances (skip invalid prefabs)
|
||||||
for (int32 i = 0; i < allPrefabs.Count(); i++)
|
for (int32 i = allPrefabs.Count() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
Prefab* prefab = allPrefabs[i];
|
Prefab* prefab = allPrefabs[i];
|
||||||
if (prefab->WaitForLoaded())
|
if (prefab->WaitForLoaded() || prefab->GetDefaultInstance() == nullptr)
|
||||||
{
|
allPrefabs.RemoveAt(i);
|
||||||
LOG(Warning, "Waiting for nesting prefab asset load failed.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (prefab->GetDefaultInstance() == nullptr)
|
|
||||||
{
|
|
||||||
LOG(Warning, "Failed to create default prefab instance for the nested prefab asset.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user