You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity中按钮使用一次后无法再次点击的问题求助

Unity 2022.3.36f1 场景切换后按钮无法点击问题

我在Unity 2022.3.36f1版本中创建了首个游戏项目,仅实现两个场景切换功能:

  • 从Menu场景通过「New game」按钮切换到MainGame场景
  • 从MainGame场景通过「Back」按钮返回Menu场景

首次切换均正常,但第二次进入MainGame场景后,「Back」按钮虽处于激活状态且Interactable选项已勾选,却无法点击(按钮可移动,但点击无响应)。此外发现每次加载MainGame场景时,该按钮都会变为不可点击状态。

我仅使用了如下脚本:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ReloadScene : MonoBehaviour
{
    
    public void ChangeScene(string Scene)
    {
        SceneManager.LoadScene(Scene);
    }
}

该脚本分别挂载在两个场景的空对象「SceneManager1」和「SceneManager2」上。

补充信息:

  • 目前功能仅能正常运行一次,加载MainGame场景后,Menu场景会从Hierarchy面板中消失
  • 在运行模式下尝试拖回Menu场景时,会触发如下报错:

InvalidOperationException: This cannot be used during play mode, please use SceneManager.LoadScene()/SceneManager.LoadSceneAsync() instead.
UnityEditor.SceneManagement.EditorSceneManager.OpenScene (System.String scenePath, UnityEditor.SceneManagement.OpenSceneMode mode) (at <2201ab87e660427c974282df3bb3cf36>:0)

我已尝试重新加载所有场景、重启项目,但均无效。


内容的提问来源于stack exchange,提问作者Derfi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 14:04:59