{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call/",
  "atlas": "https://www.pystone.net/?node=uwa-answer-ugui-dynamic-item-draw-call#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call.md",
  "context": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:uwa-answer-ugui-dynamic-item-draw-call",
  "slug": "uwa-answer-ugui-dynamic-item-draw-call",
  "title": "UGUI 动态加载Item DrawCall问题",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "石心.Yong"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "UGUI 动态加载Item DrawCall问题",
  "contentRole": "source",
  "sourceType": "source",
  "sourceMetadata": {
    "author": "石心.Yong"
  },
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "external_source",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "ef5dab35997859040ac3c097d56f1aeac7eaa8d06f4db6a6534f0afdecf3f3f5",
  "assets": [
    {
      "reference": "assets/609935306bb31032f97915b2/01.png",
      "url": "/media/2271f6fa9582741857ea.png",
      "mediaType": "image/png",
      "contentHash": "2271f6fa9582741857eabe0216a174d46d21a9b379bd525cd54a48965b54725e",
      "byteLength": 44309,
      "width": 635,
      "height": 257
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "UGUI 动态加载Item DrawCall问题",
      "anchor": "ugui-动态加载item-drawcall问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call/#ugui-%E5%8A%A8%E6%80%81%E5%8A%A0%E8%BD%BDitem-drawcall%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "问题",
      "anchor": "问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call/#%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "我的回答",
      "anchor": "我的回答",
      "citation": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call/#%E6%88%91%E7%9A%84%E5%9B%9E%E7%AD%94"
    },
    {
      "depth": 2,
      "text": "来源与关系",
      "anchor": "来源与关系",
      "citation": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "claims": [],
  "outgoing": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "上位集合：我的 UWA 问答",
      "citation": "https://www.pystone.net/notes/uwa-answer-ugui-dynamic-item-draw-call/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "incoming": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "2021-05-11：UGUI 动态加载Item DrawCall问题（UGUI、渲染模块）",
      "citation": "https://www.pystone.net/notes/my-uwa-answers/#2021"
    },
    {
      "id": "note:game-graphics-and-runtime",
      "title": "游戏图形与运行时",
      "url": "https://www.pystone.net/notes/game-graphics-and-runtime/",
      "atlas": "https://www.pystone.net/?node=game-graphics-and-runtime#knowledge-atlas",
      "label": "游戏图形与运行时",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "我的UWA问答中的“2021-05-11 - UGUI 动态加载Item DrawCall问题”导航项",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#%E6%88%91%E7%9A%84uwa%E9%97%AE%E7%AD%94"
    }
  ],
  "contentMarkdown": "# UGUI 动态加载Item DrawCall问题\n\n> [!note] 我的 UWA 问答\n> 本文收录我在 UWA 问答发表的公开回答。问题内容归原提问者；回答保留当时语境，技术结论可能受 Unity 版本、平台和项目条件限制。\n\n## 问题\n\n![QQ图片20210510212702.png](assets/609935306bb31032f97915b2/01.png)\n\n关于动态加载Item,这样是不是算是穿插了，如果有大量的Item那得多少DrawCall,我感觉我走入了误区，求大佬解答下，怎么学习这方面，好迷糊，还是说实际工作中，都不去管这种？\n\n- 提问者：甲乙丙是新手\n- 提问时间：2021-05-11 05:29:20\n\n## 我的回答\n\n共享相同材质的网格，满足其他合批条件，以相邻顺序渲染即可合批，减少Drawcall。所以合批的关键，在于对使用相同材质的物体，控制渲染顺序。\n\n合批条件和优化方案有以下资料:\n\nhttps://blog.uwa4d.com/archives/optimzation_cpu.html\n\nhttps://docs.unity3d.com/Manual/DrawCallBatching.html\n\nUnity中影响渲染顺序的因素：https://zhuanlan.zhihu.com/p/55762351\n\n不同的资源控制渲染顺序的方式不同，如MeshRenderer，可以设置材质的RenderQueue；ParticleSystem可以设置Order In Layer和Sorting Layer等。\n\nUGUI元素的渲染顺序是UGUI这个插件本身决定的，我们要做的是理解UGUI对元素渲染的排序方式，尽可能使相同材质的UI元素以相邻顺序渲染。具体的关键点譬如：避免同一层的UI元素互相重叠，UGUI是一层一层绘制的，保证相同材质的UI作为同一层来绘制。如题主项目中的Img都放在同一层，Txt都放在第二层。如果两个Img发生叠层，就会有一个Img是作为第二层来绘制的，导致Txt的绘制与Img的绘制互相穿插，就会增加DrawCall\n\n- 回答时间：2021-05-11 06:31:19\n- 最后更新：2021-05-11 18:20:05\n- 采纳状态：未采纳\n\n## 来源与关系\n\n- 上位集合：[[10-计算机、信息技术与工程/05-游戏图形与运行时/我的UWA问答/我的UWA问答|我的 UWA 问答]]\n- UWA 标签：UGUI、渲染模块\n- 原始问题：[UGUI 动态加载Item DrawCall问题](https://answer.uwa4d.com/question/609935306bb31032f97915b2)\n- 源页最后更新：2021-05-11 06:31:19\n"
}
