Adding a dynamic binding and preforming a hot reload sometimes causes the binding to not be registered by class/blueprint instances that already exist in the world. Instances need to be replaced from the Content Browser after the hot reload to register the updating binding.
Repro Rate:
4/10
Regression:
No - same behavior occurs with 4.16.3 (CL 3561208)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test) class UBoxComponent* _box; UFUNCTION(BlueprintCallable, Category = test) void OnBoxOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
#include "Runtime/Engine/Classes/Components/BoxComponent.h" #include "Engine.h"
_box = CreateDefaultSubobject<UBoxComponent>(TEXT("MyBox")); _box->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::OnBoxOverlapBegin);
void AMyActor::OnBoxOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult) { if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::MakeRandomColor(), TEXT("Enter")); } }
UFUNCTION(BlueprintCallable, Category = test) void OnBoxOverlapEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
_box->OnComponentEndOverlap.AddDynamic(this, &AMyActor::OnBoxOverlapEnd);
void AMyActor::OnBoxOverlapEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex) { if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::MakeRandomColor(), TEXT("Exit")); } }
Result:
The instance placed in step 6 will have the BeginOverlap text (Enter) print but the EndOverlap text (Exit) does not print
Expected:
Placed instances update dynamic binding that is added/hot reloaded
Head over to the existing Questions & Answers thread and let us know what's up.
1 |
Component | UE - Foundation - Cpp Tools - Hot Reload |
---|---|
Affects Versions | 4.16.3, 4.17.2, 4.18 |
Created | Oct 6, 2017 |
---|---|
Resolved | Oct 9, 2017 |
Updated | Jul 14, 2021 |