The problem is that I need to pass a TSciptDelagate to the Add function, but I don’t know it’s signature. Also I want to pass a delegate with the “void Function()” signature. Can you help me out?
BTW mate, where I can see the signatures of all delegates? I am currently watching the documentation for the TScriptDelegate and there nothing that tells me what the signature is?
You can find signatures list and where they are declared in the docs, for example - Components | Unreal Engine Documentation, lists all the delegates used in components. Check marshaling category to find out delegate parameters.
There should be something like Go to definition in Visual Studio, just highlight type, right click and look for something like find declaration/go to definition. I use Visual Assist X add-on for Visual Studio, there is such feature, but i’m not sure about the stock VS; though it should have it too.
P.S. Inside your (Begin/End)Overlap function you check for GEngine, i believe that if delegate happened to trigger, there is no way GEngine could be null, something really weird must happen, but if that happened, engine will crash much earlier before your delegate
I figured it out, not sure if it is documented or not, but it probably is. It is just these things change with every version. At least since I figured it out, no one else has to for this version.
This forum post is old, but I keep coming back to it, and the info is too outdated, so here’s a more up to date way to do OnCompnentBeginOverlap() that works with at least 4.22.3. The difference in parameters seems to be the UPrimitiveComponent* OverlappedComp parameter.
AMonkey::AMonkey()
{
...
// ^ Definition of MonkeyMesh up here
//Then add the delegate:
MonkeyMesh->OnComponentBeginOverlap.AddDynamic(this, &AMonkey::OnMonkeyBeginOverlap);
}
void AMonkey::OnMonkeyBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
//Make the monkey explode here, or something...
}
I guess the parameters for OnComponentBeginOverlap() have changed, so this is the only way I could get it to work. Here is a link to the documentation that I found on this (if you’re into that stuff):
In 4.27.2 the parameters set for on_begin_overlap_delegate is next: (class UPrimitiveComponent* OtherComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp2, int32 OtherBodyIndex, bool someBool, const FHitResult& hitResult)