简体   繁体   English

按下开始按钮后游戏不运行

[英]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.

相关问题 按下按钮后游戏冻结 - Game freezes after the button is pressed Start方法结束并按下按钮后,带有“ new”关键字的实例化类为null。 Unity3d - Instantiated class with “new” keyword is null after Start method has ended and button is pressed. Unity3d 为什么当在构建环境中运行游戏时,单击“开始游戏”按钮时,它不起作用,而在编辑器中却起作用? - Why when clicking on START GAME button when the game is running in build it's not working does nothing but it's working in the editor? Unity 2019.2.0f1。 在Android的初始屏幕显示期间按下返回按钮后,游戏无法重新启动吗? - Unity 2019.2.0f1. Game doesn't restart after back button pressed during splash screen display in android? Process.Start即使在关机后仍保持蒸汽游戏运行 - Process.Start keeps steam game running even after it has shutdown 不再按下按钮时动画继续运行 - the animation keep running when the button is no longer pressed 按下新游戏按钮时,C#Unity 2D游戏菜单无法启动游戏 - C# Unity 2D Game Menu isn't starting the game when the new game button is pressed 跳过游戏窗口激活作为在unity3d中按下播放按钮 - Skipping Game Window Activation as Play Button Pressed in unity3d 为什么按下按钮时我的方法没有全部运行? - Why is my method not running all my when the button is pressed? 过渡到“游戏结束”场景后按钮不起作用 - Button not working after transitioning to "game over" scene
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM