Unity性能优化笔记——UI优化

NGUI:

cs 复制代码
public class UIGeometry
{
   public BetterList<Vector3> verts = new BetterList<Vector3>();
   public BetterList<Vector2> uvs = new BetterList<Vector2>();
   public BetterList<Color32> cols = new BetterList<Color32>();
   public BetterList<<Vector3> mRtpVerts = new BetterList<Vector32>();
}

UGUI:

cs 复制代码
public class VertexHelper:IDisaposable
{
   private List<Vector3> m_Positions = ListPool<Vector3>.Get();
   private List<Color32> m_Colors = ListPool<Color32>.Get();
   private List<Vector2> m_Uv0s = ListPool<Vector2>.Get();
   private List<Vector2> m_Uv1s = ListPool<Vector2>.Get();
   private List<Vector3> m_Normals = ListPool<Vector3>.Gte();
   private List<Vector4> m_Tangents = ListPool<Vector4>.Get();
   private List<int> m_Indices = ListPool<int>.Get();
}

元素更新方式:

NGUI:

UIPanel.LateUpdate

1.轮询

2.UIPanel.UpdateWidgets

UGUI:

Canvas.SendWillRenderCanvas

1.队列

2.m_LayoutRebuildQueue

3.m_GraphicRebuildQueue

UGUI如果Canvas没有变化Canvas.SendWillRenderCanvas是完全没有开销的

处理隐藏显示元素方式

NGUI:

1.大量的SetActive(false),

2.适量的Color.a = 0 ,移出

3.Time + 二级缓存

UGUI

1.scale = 0,Alpha Group = 0

修改一个UI元素最终会转变成很多组的顶点属性,同过这些顶点属性转换成mesh。动态的UI元素要控制数组里面的顶点数。

对于制作的影响:

1."动态"元素尽量少用OutLine.Tiled Sprite。

2.尽量减少"动态"长文本。

待补充。。。

相关推荐
WarPigs1 天前
Unity无法修改Assembly-CSharp.csproj错误
unity
FairGuard手游加固2 天前
手游加固怎么做?SO、IL2CPP、AssetBundle 与运行时保护详解
安全·游戏·unity
阿松爱学习3 天前
【Unity开发】监听Scene场景事件
unity·c#
xiaogai_gai3 天前
BOM 物料清单同步实战:金蝶云星空 → 四化智造 MES 修改场景深度拆解
unity·游戏引擎
淡海水3 天前
03-03-架构篇-SGen GC架构解析
unity·架构·c#·gc·sgen
萌萌的提莫队长4 天前
Unity相机捕捉,图像识别,抠像+合成
opencv·unity
mxwin5 天前
Unity Shader 光线追踪原理与实战案例
unity·游戏引擎
地狱为王5 天前
Unity使用DPDFNet实现实时语音增强(降噪)
unity·语音增强·降噪·dpdfnet
平行云PVT5 天前
国产信创实时云渲染解决方案:如何实现数字孪生与三维应用云化部署?
unity·webrtc·unreal engine·实时云渲染·国产信创·摩尔线程·砺算科技
夏炎黄5 天前
Terrain地形剪裁
unity