Reputation:
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:
Upvotes: 5
Views: 13342
Reputation: 617
attach that script to a game object as a component then drag that object to OnClick and you will find the functions.
Upvotes: 14