大家好,我在PC上制作3D游戏,射击游戏,有两个PlayerController脚本,第一个中的ExitToMenu设置玩家控制,包括光标可见性(false)
private void Start()
{
controller = GetComponent<CharacterController>();
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
第二个,当你按Esc时,它会转移到为游戏菜单制作的新场景,但光标不返回,我这样写,以便退出时光标返回,但它不起作用(在构建中也)
{
public void Exit()
{
SceneManager.LoadScene(0);
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = true;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(Input.GetKeyUp(KeyCode.Escape))
{
Exit();
}
}
}
请帮帮我,出了什么问题
因此,您首先返回光标,然后加载场景,而不是相反。