IsEditorOnly is not reflected in grandchild actor when parent/child/grandchild are constructed with ChildActorComponent. This causes the issue that actor will increase incorrect when save the level.
Workaround:
Change the following code in ChildActorComponent.cpp.
void UChildActorComponent::CreateChildActor()
{
// ...
#if 1 // changed start
bool isEditorOnly = IsEditorOnly();
if (MyOwner)
{
isEditorOnly = isEditorOnly || (MyOwner->IsEditorOnly() || MyOwner->HasAllFlags(RF_Transient));
}
if(HasAllFlags(RF_Transient) || isEditorOnly)
#else // original
if (HasAllFlags(RF_Transient) || IsEditorOnly())
#endif // changed end
{
// If we are either transient or editor only, set our created actor to transient. We can't programatically set editor only on an actor so this is the best option
Params.ObjectFlags |= RF_Transient;
}
// ...
}
When see the World Outliner, the Actor (BP_GrandChild) has increased on the level.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-85478 in the post.
| 0 |
| Component | UE - Gameplay - Components |
|---|---|
| Affects Versions | 4.22, 4.23, 4.24 |
| Target Fix | 4.26 |
| Fix Commit | 14105452 |
|---|
| Created | Dec 6, 2019 |
|---|---|
| Resolved | Aug 28, 2020 |
| Updated | Apr 28, 2021 |