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.尽量减少"动态"长文本。

待补充。。。

相关推荐
叶帆3 天前
【YFIOs】用C#开发硬件之设备上云
开发语言·unity·c#
久数君3 天前
AI三维建模工具“造形家”:地理场景三维化的高效解决方案
unity·glb·ai算法·ai三维建模工具·地图框选·造形家·城市建筑模型
会思考的猴子4 天前
Unity VFX 属性 Postion 和 TargetPostion
unity
心前阳光4 天前
Unity资源导入之自动化资源导入
unity·自动化·游戏引擎
心前阳光4 天前
Unity之2021.3.45f2c1发布安卓程序遇到的问题
android·unity·游戏引擎
纪纯4 天前
PicoVR Unity Integration SDK 3.4 常用交互API
unity·游戏引擎·vr·pico
龙智DevSecOps解决方案4 天前
3A 游戏优化技术栈:如何打通引擎级分析工具与 DevOps 持续集成管线?
unity·性能优化·游戏开发·技术美术·perforce·unrealengine
葛兰岱尔4 天前
从 SolidWorks 到 Three.js,从 Inventor 到 Unity——制造业CAD模型“几何-语义一体化“转换,不再是天方夜谭!
开发语言·javascript·unity
玉夏4 天前
【Shader基础】UV 与纹理采样 Part1
unity·着色器·uv
zdr尽职尽责4 天前
Unity录像功能
学习·ui·unity·游戏引擎