{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/uwa-answer-sprite-atlas-asset-bundle-duplication/",
  "atlas": "https://www.pystone.net/?node=uwa-answer-sprite-atlas-asset-bundle-duplication#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/uwa-answer-sprite-atlas-asset-bundle-duplication.md",
  "context": "https://www.pystone.net/notes/uwa-answer-sprite-atlas-asset-bundle-duplication.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:uwa-answer-sprite-atlas-asset-bundle-duplication",
  "slug": "uwa-answer-sprite-atlas-asset-bundle-duplication",
  "title": "UI在使用SpriteAtlas时的原理，以及打AB包的时候SpriteAtlas的“冗余”问题",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "石心.Yong"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "UI在使用SpriteAtlas时的原理，以及打AB包的时候SpriteAtlas的“冗余”问题",
  "contentRole": "source",
  "sourceType": "source",
  "sourceMetadata": {
    "author": "石心.Yong"
  },
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "external_source",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "7410d34f0160e3ea154ed42b234e344fe10c4a80a59b2f8dc01b6db66e4f3971",
  "assets": [
    {
      "reference": "assets/608949fa6bb31032f9791494/01.png",
      "url": "/media/48f056d272c28bec0990.png",
      "mediaType": "image/png",
      "contentHash": "48f056d272c28bec09903038c8bae3ec22a49315e9cafc82e62094f656d95d8f",
      "byteLength": 3689,
      "width": 300,
      "height": 70
    },
    {
      "reference": "assets/608949fa6bb31032f9791494/02.png",
      "url": "/media/7f463aca6c1159b0fccb.png",
      "mediaType": "image/png",
      "contentHash": "7f463aca6c1159b0fccb711ba12ba75e3e952da3a9be97ebcc0e7082de3f3506",
      "byteLength": 23600,
      "width": 470,
      "height": 361
    },
    {
      "reference": "assets/608949fa6bb31032f9791494/03.png",
      "url": "/media/cdc4ce2e336aea73976d.png",
      "mediaType": "image/png",
      "contentHash": "cdc4ce2e336aea73976de321fc35ffd17c36980f7afd4185e15480c986de214f",
      "byteLength": 3929,
      "width": 247,
      "height": 79
    },
    {
      "reference": "assets/608949fa6bb31032f9791494/04.png",
      "url": "/media/ce038fe549a1bdf79a9f.png",
      "mediaType": "image/png",
      "contentHash": "ce038fe549a1bdf79a9f22ff4c50ec855c9960af905d6cbe1d0507100244922d",
      "byteLength": 10056,
      "width": 458,
      "height": 185
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "UI在使用SpriteAtlas时的原理，以及打AB包的时候SpriteAtlas的“冗余”问题",
      "anchor": "ui在使用spriteatlas时的原理以及打ab包的时候spriteatlas的冗余问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-sprite-atlas-asset-bundle-duplication/#ui%E5%9C%A8%E4%BD%BF%E7%94%A8spriteatlas%E6%97%B6%E7%9A%84%E5%8E%9F%E7%90%86%E4%BB%A5%E5%8F%8A%E6%89%93ab%E5%8C%85%E7%9A%84%E6%97%B6%E5%80%99spriteatlas%E7%9A%84%E5%86%97%E4%BD%99%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "问题",
      "anchor": "问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-sprite-atlas-asset-bundle-duplication/#%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "我的回答",
      "anchor": "我的回答",
      "citation": "https://www.pystone.net/notes/uwa-answer-sprite-atlas-asset-bundle-duplication/#%E6%88%91%E7%9A%84%E5%9B%9E%E7%AD%94"
    },
    {
      "depth": 2,
      "text": "来源与关系",
      "anchor": "来源与关系",
      "citation": "https://www.pystone.net/notes/uwa-answer-sprite-atlas-asset-bundle-duplication/#%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-sprite-atlas-asset-bundle-duplication/#%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-04-30：UI在使用SpriteAtlas时的原理，以及打AB包的时候SpriteAtlas的“冗余”问题（资源管理、UI、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-04-30 - UI在使用SpriteAtlas时的原理，以及打AB包的时候SpriteAtlas的“冗余”问题”导航项",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#%E6%88%91%E7%9A%84uwa%E9%97%AE%E7%AD%94"
    }
  ],
  "contentMarkdown": "# UI在使用SpriteAtlas时的原理，以及打AB包的时候SpriteAtlas的“冗余”问题\n\n> [!note] 我的 UWA 问答\n> 本文收录我在 UWA 问答发表的公开回答。问题内容归原提问者；回答保留当时语境，技术结论可能受 Unity 版本、平台和项目条件限制。\n\n## 问题\n\n我之前对SpriteAtlas的理解是，UI在渲染的时候会根据关联的Sprite信息找到对应的SpriteAtlas，这样每个UI渲染都用了同样的Atlas，这样可以减少DrawCall。\n\n所以理论上来讲，应该只需要Atlas这一张图就好了。\n\n可为什么我看到打Atlas的AB包里除了Atlas图还有引用的原图。在UI的AB包里，也有引用的原图。\n\n请问为什么有这样的“冗余”，以及到底Image引用的是图集还是图片，原理是什么？\n\n谢谢~\n\n- 提问者：安日天\n- 提问时间：2021-04-29 03:41:46\n\n## 我的回答\n\n不过确实存在一个冗余的问题：如果prefab1和prefab2引用了同一个atlas的sprite，那么这个atlas至少要主动包含在一个AB中，否则会被动打入两个包中，造成冗余。\n\natlas没有设置AB包：\n\n![image.png](assets/608949fa6bb31032f9791494/01.png)\n\n![image.png](assets/608949fa6bb31032f9791494/02.png)\n\natlas打到其中一个AB包中：\n\n![image.png](assets/608949fa6bb31032f9791494/03.png)\n\n![image.png](assets/608949fa6bb31032f9791494/04.png)\n\n- 回答时间：2021-04-30 06:17:56\n- 最后更新：2021-04-30 07:25:22\n- 采纳状态：未采纳\n\n## 来源与关系\n\n- 上位集合：[[10-计算机、信息技术与工程/05-游戏图形与运行时/我的UWA问答/我的UWA问答|我的 UWA 问答]]\n- UWA 标签：资源管理、UI、UGUI\n- 原始问题：[UI在使用SpriteAtlas时的原理，以及打AB包的时候SpriteAtlas的“冗余”问题](https://answer.uwa4d.com/question/608949fa6bb31032f9791494)\n- 源页最后更新：2021-04-30 06:17:56\n"
}
