Event trigger, function not present.
Hye everyone, I have two questions about event triggers. I have a "UIInventoryItem" script that is supposed to have functions that are returned by the event trigger. But they don't appear in the list. Do you know why?
public void OnEndDrag(PointerEventData eventData)
{
OnItemEndDrag?.Invoke(this);
}
My second question would be if the event trigger is still useful with the new input system?
Good evening,
Answer by Monsoonexe · Feb 21 at 12:47 AM
UnityEvents only support a few function signatures. They are limited to functions that return void and take a single parameter (or none), and that parameter must be a primitive type such as bool
, int
, float
, or UnityObject
.
You can't see it in the list because PointerEventData
is too complex. I suggest making a new function: void OnEndDrag() { OnItemEndDrag?.Invoke(this); }
.
https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html
Thank you for the answer. However, what I don't understand is that this is from a tutorial and it seems to work. in : 10:30 and 14:03
Good day,
Your answer
Follow this Question
Related Questions
Issue with EventSystems in 2018.4.2f1 0 Answers
Script to do multiple event with a button 0 Answers
How do I adjust code so gyro translates player to center position when device is being held in hands 1 Answer
Setting buttons used by Input.GetAxis() pragmatically. 0 Answers
Custom InputHandler is giving different results between Editor and final Build 0 Answers