Unity 如何提高移动设备的 3d 游戏性能?

Unity how to improve your 3dDgame preformance for mobile devices?

我已经在 unity 3d 中为 android 构建了一个弹球游戏,对于一些低端移动设备,它 运行 正在缓慢地运行。我正在考虑聘请一位统一专家来简化代码,以便它 运行 在所有设备上都更好。

但我想知道这是否可能。您可以通过更改代码使游戏预制件更好吗?我必须补充一点,这是我的第一个 unity 项目,它非常混乱。

感谢您的帮助

当然,有很多方法可以通过更改代码来显着提高性能,具体取决于您当前的工作方式。

其中之一是 object pooling when dealing with frequent creation/destruction of objects, another is caching component references when they are used often every frame. And if you're still using OnGui for your interface, probably avoid it 支持新的(从 4.6 开始)GUI 系统。但是你的问题没有包含你的代码,所以我不能给出优化你的代码的明确解决方案。

不过,并非所有代码都有问题,只是关键脚本有问题。我的建议是查看 Unity Profiler to determine which areas in your code are slowing down your game the most, then take steps to try reducing the execution time. You should also take into consideration non-code problems (eg. With lighting, geometry, materials, textures). Take a look at the guide Unity provides 以获取有关如何解决这些问题的想法

如果您仍然遇到问题,那么您可以将该特定代码带到 Whosebug,看看它是否可以进一步改进。希望这可以帮助!如果您有任何问题,请告诉我。