Description

If a base class function returns its own class as a literal value, the nativization process will emit the literal term as "GetClass()" rather than as the actual value (e.g. UBPBase::StaticClass()). If the base class function is then called from a child class, this will result in incorrectly returning a value that equates to the child class rather than the base class.

Suggested workaround: Override the function in the child class and return the base class by value (i.e. duplicate the base class implementation in the child class).

Steps to Reproduce
  1. Launch UE4 editor and create a new, blank Blueprint-only project.
  2. Create a new Blueprint asset (BPBase). Double-click to open it for editing.
  3. Create a new function (BaseFunc).
  4. Add a new output parameter that returns the base class by value (see screenshot).
  5. Compile, save and close the Blueprint editor.
  6. Right-click BPBase and choose Create Child Blueprint Class (BPChild). Double-click to open it for editing.
  7. Switch to the event graph and drag off the BeginPlay event node, and add a call to BaseFunc.
  8. Drag off the output exec pin on the BaseFunc call node and add a call to PrintString.
  9. Drag off the output param on the BaseFunc call node and wire it to the "In String" pin on the PrintString node.
  10. Compile, save and close the Blueprint editor.
  11. Drag an instance of BPChild into the level. Save it (NewMap).
  12. PIE, and note that 'BPBase_C' is displayed in the console output.
  13. Exit PIE, then choose Edit->Project Settings->Project->Packaging.
  14. Change "Blueprint Nativization Method" to "Inclusive."
  15. Under Project->Maps & Modes, set the Game Default Map to 'NewMap', then close the Project Settings window.
  16. Now choose File->Package Project->Windows->Windows (64Bit) and wait for packaging to finish.
  17. Browse to the build output folder and launch the game. Note that 'BPChild_C' is now displayed.
    Expected result: PIE output and nativized output are the same (should be BPBase_C).
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-92505 in the post.

1
Login to Vote

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