How do i use ExecuteEvents.Execute?

I’ve read the EventSystem Manual and I found that if you want to execute the methods of an interface which derives from IEventSystemHadler you have to call ExecuteEvent.Excute.

But i don’t know how some parameters work.
Here it is the example from Unity’s Manual:
ExecuteEvents.Execute(target, null, (x,y)=>x.Message1());

How does exactly the last parameter, called “functor”, work?. What do x and y represent?
Thanks.

@Parchi
I agree this should have much more explanation!

Based on the description in the API reference for EventFunction, it looks like the last parameter is a function that says “what do you want the game object to do?”

The function takes two arguments, x and y. The “x” is the handler (the component on the game object that implements the interface) and the “y” is whatever additional data you want to pass. In the case the example there was no additional data being passed (the “null” in the second parameter), so it did not factor into the functor representing the third parameter.

So… (x,y) => x.Message1() means
“on the component that implements the interface, call the Message1() function”

If the function had taken some argument, I think you could have said

(x,y) => x.Message1(y)

Which means "on the component that implements the interface, call Message1(y), WHERE “y” is the second argument of the ExecuteEvents.Execute function.

So I think ExecuteEvents.Execute(target, “Hello World”, (x,y)=>x.Message1(y)) would call Message(“Hellow World”) on whatever component it found implementing the interface.

This is all just speculation based on reading the single API entry.