Button AddListener - pass in a UnityAction
public class DialogObjectAction
{
public string dialogText;
public string confirmText;
public string cancelText;
public UnityAction<GameObject> confirmAction;
}
//Somewhere else in my code, i created "d" as a variable of type DialogObjectAction
//And then the following line does not work
confirmButton.onClick.AddListener(d.confirmAction);
Error:
Argument 1: cannot convert from 'UnityEngine.Events.UnityAction<UnityEngine.GameObject>' to 'UnityEngine.Events.UnityAction'
How do i fix this?
Comment
Your answer
Follow this Question
Related Questions
Display loading indicator during onClick event? 0 Answers
Inherited CustomButton class is called on all scripts of type CustomButton with same Parent. 0 Answers
How to Show and Hide UI panel interchangeably with button onclick in unity 2017.1.of 3 2 Answers
Instantiated button prefab causes Delegation error on click and does not add OnClick Listener 0 Answers
How to make a UI Button who opens a new level depending on a selected object? 1 Answer