Description

Component property inheritance sometimes does not behave as expected when opening a project with the -game command line argument. Attempting to load a child Blueprint through code may not correctly obtain the default values from the parent Blueprint if the parent Blueprint contains a reference to the child Blueprint. When running the project in PIE, the values are inherited correctly.

Steps to Reproduce
  1. Create a new Basic Code project.
  2. Create a new Character Blueprint in the project.
  3. Create a new Blueprint that is a child of the previous Blueprint.
    • Name the Blueprint NewBlueprint_Child
  4. Open the parent Blueprint.
  5. Select the inherited Mesh component.
  6. Select a skeletal mesh in the Details panel.
  7. Toggle the Disable Cloth Simulation value to True.
  8. In the Event graph, add a new Object variable.
  9. Pull off of the Event Tick node's execution pin and place a Cast To node to cast to the child Blueprint from step 3.
  10. Plug the new Object variable into the Cast node's Object pin.
  11. Add a new Actor code class to the project.
  12. Add the following includes to the source file for the new Actor class:
    #include "Engine/StreamableManager.h"
    #include "Engine/AssetManager.h"
    #include "GameFramework/Character.h"
    
  13. Add the following code to the BeginPlay function body:
    FStreamableManager& Streamable = UAssetManager::GetStreamableManager();
    
    FSoftObjectPath AssetToLoad(TEXT("/Game/NewBlueprint_Child"));
    
    TSharedPtr<FStreamableHandle> NewHandle = Streamable.RequestAsyncLoad(AssetToLoad);
    NewHandle->WaitUntilComplete();
    
    UBlueprint* FoundBlueprint = FindObject<UBlueprint>(ANY_PACKAGE, TEXT("/Game/NewBlueprint_Child.NewBlueprint_Child"));
    ensure(FoundBlueprint);
    
    UObject* DefaultObject = FoundBlueprint->GeneratedClass->GetDefaultObject();
    ensure(DefaultObject);
    
    ACharacter* DefaultCharacter = Cast<ACharacter>(DefaultObject);
    ensure(DefaultCharacter);
    
    // These ensures fail when the project is opened with -game, but do not fail in PIE.
    ensure(DefaultCharacter->GetMesh()->SkeletalMesh);
    ensure(DefaultCharacter->GetMesh()->bDisableClothSimulation);
    
  14. Create a Blueprint that derives from the new Actor class.
  15. Place an instance of the new Blueprint into the level.
  16. Save the level and set it as the default startup map.
  17. Open the project using the following commandline: "Path/To/UE4Editor.exe" "Path/To/Project.uproject" -game
  18. Close the project once it has opened completely.
  19. Open the latest log file for the project.

RESULT:
The last two ensures in the code above have failed and generated call stacks in the log.

EXPECTED:
None of the ensures have failed.

Have Comments or More Details?

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

4
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint
Affects Versions4.18.34.194.20
Target Fix4.19
Fix Commit3890194
Main Commit3990065
Release Commit3890194
CreatedJan 19, 2018
ResolvedFeb 14, 2018
UpdatedApr 27, 2018
View Jira Issue