分享

【Unity UI 优化指南】

 kiki的号 2017-04-07


版本检查: 5.3

难度: 高级

Optimizing a user interface driven byUnity UI is an art. Hard-and-fast rules are rare; instead, each situation mustbe carefully evaluated with the system’s behavior in mind. The core tensionwhen optimizing any Unity UI is the balancing of draw calls with batchingcosts. While some common-sense techniques can be used to reduce one or theother, complex UIs must make trade-offs.

优化由Unity UI实现的用户界面是一门艺术。很少见很清楚的规则,相反,每种情况都必须联系系统行为,仔细考虑评估。考虑优化Unity UI时最核心的原则是结合开销,平衡draw calls,复杂的UI 需要做权衡。
   
However, as is best practice elsewhere,attempts to optimize Unity UIs should begin with profiling. The primary task before attempting tooptimize a Unity UI system is to locate the precise reason for an observedperformance problem. There are four common classes of problem encountered byusers of Unity UI:

然而,如在其他地方的最佳实践,尝试着优化Unity UI 需要从分析开始。优化Unity UI系统的首要任务是找到性能问题的准确原因。这里有Unity UI用户遇到的四个常见的问题:

1、Excessive GPU fragment shader utilization (i.e. fill-rateoverutilization)
过多的GPU片段着色器使用率(如填充过度使用)

2、Excessive CPU time spent rebuilding a canvas batch
过多的GPU时间开销在重建一个画布上

3、Excessive numbers of rebuilds of Canvas batches(over-dirtying)
画布重建数量过多

4、Excessive CPU time spent generating vertices (usuallyfrom text)
过多的CPU时间开销在生成顶点(通常是文本)

It is, in principle, possible to createa Unity UI whose performance is constrained by the sheer number of draw callsbeing sent to the GPU. However, in practice, any project overloading the GPUwith draw calls is more likely to be bound by fill-rate overutilization.

原则上,创建一个Unity UI,它的性能是由送到GPU的Draw calls数量限制。然而,实际上,任何项目超载draw call,调用GPU,都更容易被填充率过度使用约束。

This guide will discuss the fundamentalconcepts, algorithms and code underlying Unity UI as well as discussing commonproblems and solutions. It is broken into five chapters:

本指南将讨论的基本概念,Unity UI底层的算法和代码,以及常见的问题和解决方法。它分为5个部分:

1.    The Fundamentals of Unity UI chapter definesterminology specific to Unity UI and discusses the details of many of thefundamental processes performed to render the UI, including the building ofbatched geometry. It is strongly recommended that readers begin withthis chapter.
1、Unity UI基本原理,这章解释了Unity UI专用术语,讨论了一些底层性能表现的细节,渲染UI,包括批处理几何体。强烈建议读者从这章开始学习。

2.    The Unity UI profiling tools chapterdiscusses gathering profiling data with the 2、various tools available to developers.
Unity UI性能工具,本章讨论了使用各种工具收集分析数据。

3.    The Fill-rate, Canvases and input chapterdiscusses ways to improve the performance of Unity UI's Canvas and InputComponents.
填充率、画布和输入,本章讨论了提高Unity UI和输入组件性能的方法。

4.    The UI controls chapter discusses UI Text,Scroll Views and other component-specific optimizations, along with sometechniques that do not fit well elsewhere.
UI控件,本章讨论UI文本(UI Text),滚动视图(Scroll View),及其他组件的优化。

5、 The Other techniques and tips chapterdiscusses a handful of issues that do not fit elsewhere, including some basictips and workarounds for "gotchas" in the UI system.
其他技术和技巧。本章讨论一些其他地方不通用的问题,包括一些技巧和UI系统中的一些陷阱。

UI SOURCE CODE
UI 源代码

Always remember that Unity UI’s Graphicand Layout components are entirely open source. Their source code can be foundon Unity’s Bitbucket repository, under UI.

记住,Unity UI图形和布局组件是完全开源的。这些代码可以在 Unity’sBitbucket repository ,下UI 找到。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多