Developer Notes

The blueprint implementation of BeginPlay (AActor::ReceiveBeginPlay) is called from native code in AActor::BeginPlay().

If you want to call Blueprint implementation after the custom native code:

void AQATestActor::BeginPlay()

{ TestNumber = 3.f; GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Cyan, FString::SanitizeFloat(TestNumber)); Super::BeginPlay(); }
Description

If a Blueprint event graph contains a Begin Play node that connects to a call to the parent function, the functionality present in the Blueprint Begin Play segment is run before the parent Begin Play functionality occurs.

Steps to Reproduce
  1. Create a new code project using the First Person template.
  2. Add a new Actor code class to the project.
  3. Add the following code to the header file for the new class:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = TestCat)
    float TestNumber;
    
  4. Add the following code to the BeginPlay() function of the new class:
    TestNumber = 3.f;
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Cyan, FString::SanitizeFloat(TestNumber));
    
  5. Build the project in Visual Studio.
  6. Create a new Blueprint derived from the new code class that was created in step 2.
  7. Open the new Blueprint and create the setup shown in the attached BeginPlay image.
  8. Start PIE mode.

RESULT:
The output from the Blueprint Print String node displays 0.0 before the parent BeginPlay() function runs and sets the value of the variable to 3.0.

EXPECTED:
The parent BeginPlay() function runs first and sets the value of the variable to 3.0 so both output strings are the same.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

By Design
ComponentUE - Gameplay - Blueprint
Affects Versions4.7
Target Fix4.7.1
CreatedFeb 19, 2015
ResolvedFeb 21, 2015
UpdatedApr 27, 2018
View Jira Issue