为什么不触发UI按钮中的On Click()函数?

问题描述 投票:0回答:2

我正在制作VR游戏,游戏中有一个UI画布,里面有2个按钮。当我将指针悬停在按钮上时,指针会交互,按钮也会改变颜色,但是当我点击按钮时,它不会触发该功能。

这是场景的图像:

enter image description here

这是“子弹”按钮的onclick()引用:

That's the on click() reference of the "bullet" botton

具有shot()功能的Player脚本位于主摄像机上

这就是它中的镜头功能

public void Shot()
{
    Debug.Log("isEntered");
    isSeek = false;
}

而我正在使用

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

对于Player类

为什么当我按下按钮Shot时,没有触发拍摄功能?

unity3d virtual-reality google-vr
2个回答
0
投票

enter image description here

检查您是否设置了此选项


0
投票

我们需要更多的信息。

点击按钮会改变颜色吗? (如果问题出在点击或按钮本身,它会告诉我们)。我的意思是没有突出显示颜色变化,但是按下

全画布,相机,按钮参数也将提供信息。

© www.soinside.com 2019 - 2024. All rights reserved.