c# - 功能未显示在统一按钮上

标签 c# unity3d

我正在学习 Unity 和 C#。我正在尝试使用一个按钮来触发某些东西,但该功能没有显示出来。这是代码:

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

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

这是问题所在的屏幕截图:

Image showing the probleme

最佳答案

将该脚本作为组件附加到游戏对象,然后将该对象拖到OnClick,您将找到函数。

关于c# - 功能未显示在统一按钮上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63319373/

相关文章:

c# - ServiceStack.Redis 客户端 - 事务已在进行中

c# - 如何从 gethashcode 生成的 int 中获取原始字符串

c# - Firebase 实时数据库 : how can I retrieve 10 records around a specific key after ordered by value?

.net - 如何在 MonoDevelop (Unity 3D) 中将 .Net 4.0 设置为默认框架

regex - 这是正则表达式吗?

c# - 使用 Debugger.Log 调用记录附加信息

c# - 什么停止(而不是崩溃)我的 Windows 服务?

c# - arrayList c#中Add和AddRange的区别

c# - 沿 Y 位置移动玩家

user-interface - 查找 Unity UI 元素的世界空间坐标