Function not showing up on unity button

Viewed 4797

I am learning Unity and C#. I am trying to use a button to trigger something, but the function is not showing up. Here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ExitButton : MonoBehaviour
{
    public void OnButtonTrigger () {
        Debug.Log("Application Quitting");
        Application.Quit();
    }
}

And here is a screenshot of where the problem is:

Image showing the probleme

1 Answers

attach that script to a game object as a component then drag that object to OnClick and you will find the functions.

Related