# OnComponentBeginOverlap doesn't work after Update to 4.3

**URL:** <https://forums.unrealengine.com/t/oncomponentbeginoverlap-doesnt-work-after-update-to-4-3/288794>\
**Category:** World Creation\
**Tags:** overlap, UE4-3, unreal-engine, Collision, CPP, question\
**Created:** [July 21, 2014, 6:22am UTC](https://forums.unrealengine.com/t/oncomponentbeginoverlap-doesnt-work-after-update-to-4-3/288794 "2014-07-21T06:22:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_7d5900d8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7d5900d8](https://forums.unrealengine.com/u/anonymous_user_7d5900d8)\
**Post date:** [July 21, 2014, 6:22am UTC](https://forums.unrealengine.com/t/oncomponentbeginoverlap-doesnt-work-after-update-to-4-3/288794/1 "2014-07-21T06:22:39Z")

</div>

I wrote some C++ code in 4.2 for overlap experiment, but after update to 4.3 I got some build errors.  
I followed this like changed some code: [4.3 Add Dynamic On Component Overlap error - World Creation - Epic Developer Community Forums](https://answers.unrealengine.com/questions/71040/43-add-dynamic-on-component-overlap-error.html)

Now, it can pass the build but the overlap event still doesn’t work in the game.

Changes I did are like this:

```
diff --git a/Source/Rift2/BluePortalCode.cpp b/Source/Rift2/BluePortalCode.cpp
index 8d8d319..c889515 100644
--- a/Source/Rift2/BluePortalCode.cpp
+++ b/Source/Rift2/BluePortalCode.cpp
@@ -12,12 +12,12 @@ ABluePortalCode::ABluePortalCode(const class FPostConstructInitializeProperties&
     touchBox = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT("touchBox"));
     RootComponent = touchBox;
     
- touchBox->OnComponentBeginOverlap.AddDynamic(this, &ABluePortalCode::OnOverlap);
+ touchBox->OnComponentBeginOverlap.AddDynamic(this, &ABluePortalCode::OnBeginOverlap);
 
 
 }
 
-void ABluePortalCode::OnOverlap(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
+void ABluePortalCode::OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
 {
     if (GEngine)
         GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Red, "Overlapped in C++");
diff --git a/Source/Rift2/BluePortalCode.h b/Source/Rift2/BluePortalCode.h
index 7efb20c..27bb910 100644
--- a/Source/Rift2/BluePortalCode.h
+++ b/Source/Rift2/BluePortalCode.h
@@ -9,7 +9,7 @@
  *
  */
 UCLASS()
-class ABluePortalCode : public AActor
+class RIFT2_API ABluePortalCode : public AActor
 {
     GENERATED_UCLASS_BODY()
 
@@ -21,7 +21,7 @@ class ABluePortalCode : public AActor
     
     /** called when something overlaps the sphere component */
     UFUNCTION()
- void OnOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
+ void OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
 
         UFUNCTION()
         void ClearIsTeleportingFlag();
diff --git a/Source/Rift2/RedPortalCode.cpp b/Source/Rift2/RedPortalCode.cpp
index 5d4e55a..b225168 100644
--- a/Source/Rift2/RedPortalCode.cpp
+++ b/Source/Rift2/RedPortalCode.cpp
@@ -11,12 +11,12 @@ ARedPortalCode::ARedPortalCode(const class FPostConstructInitializeProperties& P
     isTeleporting = false;
     touchBox = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT("touchBox"));
     RootComponent = touchBox;
- touchBox->OnComponentBeginOverlap.AddDynamic(this, &ARedPortalCode::OnOverlap);
+ touchBox->OnComponentBeginOverlap.AddDynamic(this, &ARedPortalCode::OnBeginOverlap);
 
 
 }
 
-void ARedPortalCode::OnOverlap(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
+void ARedPortalCode::OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
 {
     if (GEngine)
         GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Red, "Overlapped in C++");
diff --git a/Source/Rift2/RedPortalCode.h b/Source/Rift2/RedPortalCode.h
index 9dbdc98..5456dbf 100644
--- a/Source/Rift2/RedPortalCode.h
+++ b/Source/Rift2/RedPortalCode.h
@@ -9,7 +9,7 @@
  * 
  */
 UCLASS()
-class ARedPortalCode : public AActor
+class RIFT2_API ARedPortalCode : public AActor
 {
     GENERATED_UCLASS_BODY()
 
@@ -21,7 +21,7 @@ class ARedPortalCode : public AActor
 
         /** called when something overlaps the sphere component */
     UFUNCTION()
- void OnOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
+ void OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
 
     UFUNCTION()
         void ClearIsTeleportingFlag();

```

---

<div class="post-metadata">

**Author:** ![ledgarl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ledgarl](https://forums.unrealengine.com/u/ledgarl)\
**Post date:** [July 24, 2014, 3:21pm UTC](https://forums.unrealengine.com/t/oncomponentbeginoverlap-doesnt-work-after-update-to-4-3/288794/2 "2014-07-24T15:21:35Z")

</div>

Hi, the solution is here 😉

> **[4.3 Add Dynamic On Component Overlap error](https://forums.unrealengine.com/questions/71040/43-add-dynamic-on-component-overlap-error.html)**
>
> The new 4.3 update has been causing some issues with my code. I have an actor which consists of a UBoxComponent that should call another function on component overlap. It was working fine in Version 4.2 when I used AddDynamic to delegate from...
