如何统一禁用物理系统
How to disable physics system in unity
我想在unity引擎中开发原生android应用程序,不需要使用物理,是否可以在unity中为特定项目禁用物理引擎。
http://answers.unity3d.com/questions/139550/how-to-disable-physics.html
此外,您可以在此处禁用分层碰撞:
https://docs.unity3d.com/Manual/class-PhysicsManager.html
How to disable physics system in unity
这过去不可能,但如果您有 Unity 2017 及更高版本,现在就可以。
禁用物理模拟:
Physics.autoSimulation = false;
启用物理模拟
Physics.autoSimulation = true;
对于 2D,使用 Physics2D.autoSimulation
。
完成后,请确保您的任何脚本中都没有 FixedUpdate()
函数。物理不会模拟。我也会将固定时间步长设置得尽可能小。
Actually I want the settings like when my app start in device it
should not load whole physics classes
不,你不能这样做。忘掉它。如果您的应用程序加载速度很慢,您需要寻找其他地方作为问题而不是 Physics API。一个示例是使用 Resources 文件夹。这很慢。此外,您应该只使用 UI 简化主场景以使其加载速度更快,然后使用 加载其余场景。确保在加载时禁用音频解压缩。您可以 Google "Unity optimize load time" 了解更多信息。
从 Unity 2019 开始,您可以使用“Unity 包管理器”完全禁用内置包。引用它们的代码将不会编译,并且它们不会包含在您构建的应用程序中。
我想在unity引擎中开发原生android应用程序,不需要使用物理,是否可以在unity中为特定项目禁用物理引擎。
http://answers.unity3d.com/questions/139550/how-to-disable-physics.html 此外,您可以在此处禁用分层碰撞: https://docs.unity3d.com/Manual/class-PhysicsManager.html
How to disable physics system in unity
这过去不可能,但如果您有 Unity 2017 及更高版本,现在就可以。
禁用物理模拟:
Physics.autoSimulation = false;
启用物理模拟
Physics.autoSimulation = true;
对于 2D,使用 Physics2D.autoSimulation
。
完成后,请确保您的任何脚本中都没有 FixedUpdate()
函数。物理不会模拟。我也会将固定时间步长设置得尽可能小。
Actually I want the settings like when my app start in device it should not load whole physics classes
不,你不能这样做。忘掉它。如果您的应用程序加载速度很慢,您需要寻找其他地方作为问题而不是 Physics API。一个示例是使用 Resources 文件夹。这很慢。此外,您应该只使用 UI 简化主场景以使其加载速度更快,然后使用
从 Unity 2019 开始,您可以使用“Unity 包管理器”完全禁用内置包。引用它们的代码将不会编译,并且它们不会包含在您构建的应用程序中。