Questions about signature for hit event

So let me get this straight.

1.UStaticMeshComponenet inherits a variable called on Component Hit from its parent UPrimitiveComponent.

2.On Component Hit can generate a hit event which is also called Muticast Delegate.

3.There is a list called invocation list which stores all the functions that respond to multicast delegate’s broadcast, and this broadcast only happens when there is a hit event.

4.In order to add a function the list, I can simply type OnComponentHit.AddDynamic( this, The function that I want to add)

  1. When declaring this function in header file , it needs to have specific signature in its parameters.

Questions:

  1. Is there anything incorret in my understanding?

  2. What’s the reason for the function have specific signature? Is it because that’s only way for hit event to recognize it and add it to the list? What is a signature?(Can’t find a proper article about it)

1 Like

Hi Vincent,
All seems in order there and you have a good grasp.

As to your question about the signature, to use the Delegate effectively, you need a number of parameters to be passed in. The caller within the engine executes the defined delegates and passes in the parameters as defined in the signature but expects that signature to be as required.

Thanks for answering. Since this is a list that I am adding to, can I pass in multiple functions which can do different things?

Of course, the function just needs to match the signature.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms