gpt4 book ai didi

c# - 在菜单 View 中启用/禁用光标

转载 作者:太空宇宙 更新时间:2023-11-03 12:17:57 25 4
gpt4 key购买 nike

<分区>

我想调出一个菜单,我可以在其中使用鼠标选择按钮,而游戏的其余部分则处于非事件状态。鼠标不应该出现。有什么建议吗?

            using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityStandardAssets.Characters.FirstPerson;

public class Puzzle1 : MonoBehaviour {
public GameObject Mika;
public GameObject ExploringUI;
public GameObject InspectingUI;
private bool menuOpen = false;

void Update () {
RaycastHit hit;
if (Input.GetKeyDown (KeyCode.J) && Physics.Raycast(transform.position, transform.forward, out hit, 8f, 1<<8 | 1<<9)) {
if (menuOpen) {
Cursor.visible = (false);
menuOpen = false;
Mika.GetComponent<FirstPersonController> ().enabled = true;
ExploringUI.SetActive (true);
InspectingUI.SetActive (false);
} else {
Cursor.visible = (true);
menuOpen = true;
Mika.GetComponent<FirstPersonController> ().enabled = false;
ExploringUI.SetActive (false);
InspectingUI.SetActive (true);
}
}
}
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com