[英]Game not running after start button is pressed
There are no compile errors or warnings.没有编译错误或警告。 My game just starts paused.
我的游戏刚开始就暂停了。 I can look around but everything is frozen.
我可以环顾四周,但一切都被冻结了。 I even tried to call
Time.timeScale = 1;
我什至尝试调用
Time.timeScale = 1;
from various start functions.从各种启动功能。 "Error on Pause" is turned off.
“暂停时出错”已关闭。
Restarting Unity has no effect.重新启动 Unity 无效。
Why is this happening?为什么会这样?
HINT: I figured out that calling Time.timeScale = 1;
提示:我发现调用
Time.timeScale = 1;
was not working because the gameObject where the script was attached to, was not set to active.无法正常工作,因为脚本附加到的游戏对象未设置为活动状态。
Check your Time Manager.检查您的时间管理器。 Sometimes it gets randomly corrupted and the scale drops to Zero.
有时它会随机损坏并且比例下降到零。 Time Manager (menu: Edit > Project Settings > Time)
时间管理器(菜单:编辑 > 项目设置 > 时间)
Have you tried to force unpause in script?您是否尝试过在脚本中强制取消暂停?
EditorApplication.isPlaying = true;
Game can start paused also because of some unknown problems with assests so you can try to reimport them.游戏也可能因为资产的一些未知问题而暂停,因此您可以尝试重新导入它们。 If it doesn't help your next move should be to reinstall unity.
如果它没有帮助您的下一步行动应该是重新安装统一。
Also make sure you don't do some very time consuming operations on Awake()
and Start()
.还要确保不要对
Awake()
和Start()
执行一些非常耗时的操作。
If anyone else has this error and the described solutions have not helped, check that the Editors Pause on Error option is not checked.如果其他人遇到此错误并且所描述的解决方案没有帮助,请检查是否未选中 Editors Pause on Error 选项。 If you go the console window you will see that tab option highlighted at the top of the window if it is on, unticking that will allow the game to play if it is starting paused because of an error.
如果您使用 go 控制台 window,您将看到 window 顶部突出显示的选项卡选项(如果它已打开),取消勾选这将允许游戏在开始时出现错误。 This option being turned on would likely be your issue if the issue replicates across different projects.
如果问题在不同项目中重复,则打开此选项可能是您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.