user13898619
user13898619

Reputation:

Function not showing up on unity button

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

Upvotes: 5

Views: 13342

Answers (1)

Omar Ghannou
Omar Ghannou

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

Related Questions