Trying to send an UnityAction as a parameter for one of my methods, like so:
testMethod(1, "somestring", MyAction);
this works fine, but now I want to pass the following Action as a parameter:
public void ActivateQuest(int questId)
{
Debug.Log("This is the id: " + questId);
}
However, it will not work when I use an action that has a parameter:
testMethod(1, "somestring", ActivateQuest(2));
The above gives error: Cannot convert from void to UnityAction.
If I try the only solution I found online:
UnityAction<int> test = QuestManager.Instance().ActivateQuest;
testMethod(1, "somestring", test(2));
I get the same error. How can I pass a UnityAction with a parameter, as a parameter?
EDIT:
I finally call my action like so:
dialog.OnAccept(onLastPagePrompt, () =>
{
conversation.action();
dialog.Hide();
});