Some Actor and Component classes provided with Unreal include event handlers in the form of virtual functions. This recipe will show you how to customize those handlers by overriding the virtual functions in question.
Handling events that have been implemented via virtual functions
How to do it...
- Create an empty Actor in the Editor. Call it MyTriggerVolume:
- Add the following code to the class header:
UPROPERTY()
UBoxComponent* TriggerZone;
UFUNCTION()
virtual void NotifyActorBeginOverlap(AActor* OtherActor) override;
UFUNCTION()
virtual void NotifyActorEndOverlap(AActor* OtherActor) override;
- Because we are referencing a class that's isn't a part of our project already, we also need to add an #include...