I also have the following problem, I start the game in play mode and when I press the button to restart the scene, the scripts no longer work. They are not disabled, nothing.
我也有以下问题,我在Play模式下启动游戏,当我按下按钮重新启动场景时,脚本不再起作用。他们没有残疾,什么都没有。
Hello. I also have the following problem, I start the game in play mode and when I press the button to restart the scene, the scripts no longer work. They are not disabled, nothing.
你好。我也有以下问题,我在Play模式下启动游戏,当我按下按钮重新启动场景时,脚本不再起作用。他们没有残疾,什么都没有。
YouTube video: https://youtu.be/OD9KCmGuZDg
Youtube视频:https://youtu.be/OD9KCmGuZDg
更多回答
No errors. Every time I restart or change the scene the scripts stop working and I have to exit and re-enter the game to get it working again
没有错误。每次我重新启动或更改场景时,脚本停止工作,我必须退出并重新进入游戏才能使其再次工作
Add minimal reproducible example? I don't know though how to add this because this is a unity and just code maybe can't solve the problem.
添加最低限度的可重现示例?虽然我不知道如何添加这一点,因为这是一个整体,仅仅代码可能不能解决问题。
Only 1 script not working or all scripts?
只有一个脚本不起作用,还是所有脚本都不起作用?
any usage of DontDestroyOnLoad
/ static
s and maybe stuff loosing references to things that got destroyed on scene reload?
有没有使用DontDestroyOnLoad/Statics,以及可能会丢失对在场景重新加载时被销毁的东西的引用?
优秀答案推荐
I used to have an issue similar. In your restart script, make sure you set Time.timeScale back to one after restarting. Otherwise, the game will still be paused even after you restart.
我以前也有过类似的问题。在重新启动脚本中,确保在重新启动后将Time.timeScale设置回1。否则,即使在您重新启动后,游戏仍将暂停。
更多回答
我是一名优秀的程序员,十分优秀!