Description

Child actor component templates, when nativized, end up being owned by the converted Blueprint class object, rather than the child actor component template. Furthermore, we don't regenerate the child actor template when the child actor component is renamed in the Blueprint editor, so if the class is set while the component is still set to the default "ChildActor" name, the resulting child actor template object will use that name as a prefix, and it won't change even if the component is later renamed.

If another child actor component is then added and the child actor class is set to the same class type as the first, the child actor template will end up with the same name as the first. However, each child actor template is owned by each individual child actor component template, so this doesn't cause any issues in either the editor or the cooked build when nativization is disabled (as it is by default).

However, when the Blueprint class is nativized, the code that's generated to instance the child actor template objects does so with the converted Blueprint class as its Outer in both cases. As a result, after the first child actor template is instanced and initialized, the second child actor template is subsequently instanced using the same object name. This replaces the first instance and any child actor template data customizations are effectively lost at runtime as a result.

Current suggested workaround:

In the Blueprint editor, you can force the template to be recreated with the correct name by changing the child actor class away and then back in the Details panel. However, note that any specific property value overrides you've changed away from the default value on the template may get lost in the switch, so you might have to keep track of and reset those as well.

Steps to Reproduce
  1. Launch UE4 editor.
  2. Create a new Actor-based Blueprint class (BP_Owner).
  3. Double-click to edit and add a ChildActor component.
  4. In the Details tab, change the ChildActor class to 'Actor'.
  5. In the Components tree, rename the ChildActor component to "FirstChildActor"
  6. Drop down the template properties, and uncheck the "Can be damaged" box.
  7. Add another ChildActor component.
  8. In the Details tab, change the ChildActor class to 'Actor'.
  9. In the Components tree, rename the ChildActor component to "SecondChildActor"
  10. Compile, save and close the BP editor.
  11. Open the Level Blueprint and drag off the BeginPlay node to create a new SpawnActorFromClass node.
  12. Change the "Class" input pin to "BP_Owner" and connect a default value to the "Transform" input pin.
  13. Drag off the output pin and print out the values of the "Can be damaged" property for each child actor (see screenshot).
  14. Compile, and save the level (NewMap).
  15. PIE, and note that the values that print out are 'false' and 'true' for each child actor, respectively. Exit PIE.
  16. In Editor->Project Settings (Maps & Modes), change the Game default map to "NewMap."
  17. Still in project settings (Packaging), change "Blueprint Nativization Method" to "Inclusive."
  18. Close the project settings window.
  19. Choose File->Package Project->Windows->Win64, choose a location and wait for packaging to finish.
  20. Launch the packaged EXE. Note that the values that print out are now 'true' and 'true'.
    Expected result: Printed values should match what we see in PIE/non-nativized cooked builds.
Callstack

N/A

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-87553 in the post.

4
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.224.234.24
CreatedJan 27, 2020
ResolvedJul 15, 2021
UpdatedJul 19, 2021
View Jira Issue