C# Modal Panel Error

So I’ve been following the Modal Panel Tutorial, tweaking it a bit to work for me. But it hasnt been going great. I’ve been getting the error:

Here’s my code:
For ModalPanel.cs

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System.Collections;

public class ModalPanel : MonoBehaviour {

    public Text question;
    public Button yesButton;
    public Button noButton;
    public Button cancelButton;
    public Button okButton;
    public GameObject modalPanelObject;

    private static ModalPanel modalPanel;
   
    public static ModalPanel Instance () {
        if (!modalPanel) {
            modalPanel = FindObjectOfType(typeof (ModalPanel)) as ModalPanel;
            if (!modalPanel)
                Debug.LogError ("There needs to be one active ModalPanel script on a GameObject in your scene.");
        }
       
        return modalPanel;
    }
   
    //Yes/No/Cancel/Ok: A string, A Yes event, a no event, an OK event and a cancel event
    public void Choice (string question, UnityAction yesEvent, UnityAction noEvent, UnityAction cancelEvent, UnityAction okEvent) {
        modalPanelObject.SetActive (true);

        yesButton.onClick.RemoveAllListeners ();
        yesButton.onClick.AddListener (yesEvent);
        yesButton.onClick.AddListener (ClosePanel);

        noButton.onClick.RemoveAllListeners ();
        noButton.onClick.AddListener (noEvent);
        noButton.onClick.AddListener (ClosePanel);

        cancelButton.onClick.RemoveAllListeners ();
        cancelButton.onClick.AddListener (cancelEvent);
        cancelButton.onClick.AddListener (ClosePanel);

        okButton.onClick.RemoveAllListeners ();
        okButton.onClick.AddListener (okEvent);
        Application.LoadLevel("MainScene");
        okButton.onClick.AddListener (ClosePanel);

        this.question.text = question;

        yesButton.gameObject.SetActive (false);
        noButton.gameObject.SetActive (false);
        cancelButton.gameObject.SetActive (false);
        okButton.gameObject.SetActive (true);
    }

    void ClosePanel() {
        modalPanelObject.SetActive (false);
    }

}

For TestModalWindow.cs:

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System.Collections;

public class TestModalWindow : MonoBehaviour {
    private ModalPanel modalPanel;
    private UnityAction myOkAction;
   
    void Awake () {
        modalPanel = ModalPanel.Instance ();
        myOkAction = new UnityAction (TestOkFunction);
    }
   
    //  Send to the Modal Panel to set up the Buttons and Functions to call
    public void TestYNC () {
        modalPanel.Choice ("Store Unavailable:The Store is currently unavailable.", myOkAction);
    }
   
    //  These are wrapped into UnityActions
    void TestOkFunction () {
        Application.LoadLevel("MainScene");
    }
}

You’re declaring your Choice method with 5 arguments.

public void Choice (string question, UnityAction yesEvent, UnityAction noEvent, UnityAction cancelEvent, UnityAction okEvent) {

And your’re calling it with 2 arguments

modalPanel.Choice ("Store Unavailable:The Store is currently unavailable.", myOkAction);

There are several ways to get around this.
First, obv. :), add the missing arguments to the call.
Second way: declare the arguments as optional (Named and Optional Arguments - C# | Microsoft Learn)
And the third way: use overloading to provide a two argument Version of Choice() (C# Overload Method - Dot Net Perls).

Ok, so I’ve deleted the events that are not in use, but it still wont load MainScene. Although the error has gone