简体   繁体   English

Unity iOS性能问题(低帧率)

[英]Unity iOS performance issues (low frame rate)

Currently, I have a relatively simple 2D game which should not be too taxing on a cpu. 目前,我有一个相对简单的2D游戏,应该不会对cpu造成太大的负担。 It runs fine on my computer however when I build it to my iPhone or iPad the game starts to be quite jittery and has a poor frame rate. 它可以在我的计算机上正常运行,但是当我将其构建到iPhone或iPad上时,游戏开始变得非常不稳定,并且帧频不佳。 Does anyone have any suggestions on how I could improve the performance (I already use object pooling et cetera I think it has something to do with my draw calls / graphics) EDIT: turns out the renderer is using most of my cpu 是否有人对我如何提高性能有任何建议(我已经使用了对象池等技术,我认为它与我的绘制调用/图形有关)编辑:事实证明渲染器正在使用我的大多数CPU

If the issue is as you say too many draw calls then one simply way to reduce those is to pack your sprites using the Sprite Packer . 如果问题是您说的太多绘制调用,那么减少这些调用的一种简单方法是使用Sprite Packer打包您的sprite。 This places all your sprites tightly which reduces the amount of draw calls, if they don't all fit nicely or there's too many of them then they will be split into subpages. 这会将您所有的精灵紧紧放置,从而减少了绘制调用的次数,如果它们不太适合或它们太多,则它们将被拆分为多个子页面。 If you'd like to see how to use the Unity texture packer in simple steps I would direct you to this blog post that talks about it in more depth. 如果您想通过简单的步骤来了解如何使用Unity纹理打包器,那么我将引导您到这篇博客文章 ,其中将对此进行更深入的讨论。 Here's a simple step by step guide that I based off of the blog post linked. 这是我根据链接的博客文章得出的一个简单的分步指南。

Step 1 Select all those sprites that you want to pack in together 步骤1:选择所有要打包在一起的精灵

Step 2 Give a Packing Tag as shown in the picture below: 步骤2给出包装标签,如下图所示:

在此处输入图片说明

Step 3 Open Sprite Packer window and perform packing 步骤3打开Sprite Packer窗口并执行打包

在此处输入图片说明

Step 4 Click the Pack button as seen above 步骤4单击“打包”按钮,如上所示

There are also third party tools like Texture Packer that can do this, and they have more complex algorithms which gives them the edge over Unity's built in verison. 还有诸如Texture Packer之类的第三方工具可以做到这一点,并且它们具有更复杂的算法,这使它们比Unity的内置版本更具优势。

It's also possible there are issues with your games performance not relating directly to draw calls, I would recommend taking a look at the official Unity guide for mobile optimisation . 您的游戏性能也可能与抽奖活动没有直接关系,我建议您参阅有关移动优化的官方Unity指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM