Hi there,
I’ve been using the Event Trigger component to easily handle events on various GameObjects. When simply wanting to call a function on an event triggering, I can just link the script and choose the function. If I want the function to require some parameters, I change the C# function definition and then add the parameter on my Event Trigger component.
My question is, what if the parameter I want to pass to my function is input data, such as the delta of the mouse or finger being dragged across the screen? Specifically, I have an Event Trigger Component with a Drag event which calls a function on a script. I want to access the Drag input data in that function.
Thanks in advance!
Thanks. I didn't see it at first. The function actually appears in the top of the list when you add the parameter. Working function declaration: public void FunctionName(BaseEventData data) Also it can be used without paramenters. Also @Glorion13 , you may as well accept your answer as correct.
– konsnosThanks @Glorion13 and @krosnos , I spent ages trawling through the source code of the EventSystem/BaseInputModule/EventTrigger, working all of this out for myself and then still failed when trying to write a function that would take PointerEventData as a parameter and that would display in the editor (the editor interface was deliberately leaving stuff out). There needs to be better documentation for this. None of this is obvious. All I wanted to do was process a double-click and right click. Neither of these should be this hard.
– aphenine