{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/uwa-answer-timeline-internal-create-playable-cost/",
  "atlas": "https://www.pystone.net/?node=uwa-answer-timeline-internal-create-playable-cost#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/uwa-answer-timeline-internal-create-playable-cost.md",
  "context": "https://www.pystone.net/notes/uwa-answer-timeline-internal-create-playable-cost.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:uwa-answer-timeline-internal-create-playable-cost",
  "slug": "uwa-answer-timeline-internal-create-playable-cost",
  "title": "TimeLine 的 Internal_CreatePlayable 开销很大",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "石心.Yong"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "TimeLine 的 Internal CreatePlayable 开销很大",
  "contentRole": "source",
  "sourceType": "source",
  "sourceMetadata": {
    "author": "石心.Yong"
  },
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "external_source",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "b1fe5062b1ce0737f527b92d1a51ee98dc7a55f9a853ed9ae902792aa0eaeb83",
  "assets": [
    {
      "reference": "assets/609c8d3a6bb31032f97916a9/01.png",
      "url": "/media/a06868ea6ce1730acc01.png",
      "mediaType": "image/png",
      "contentHash": "a06868ea6ce1730acc010b6cac21016d0961626994c3cf88e78147e40452f2fc",
      "byteLength": 17525,
      "width": 1857,
      "height": 114
    },
    {
      "reference": "assets/609c8d3a6bb31032f97916a9/02.png",
      "url": "/media/6994e478fc316c2c49d3.png",
      "mediaType": "image/png",
      "contentHash": "6994e478fc316c2c49d316e33ffa7483b0545b92f121b042151540af1d775ee6",
      "byteLength": 26958,
      "width": 976,
      "height": 106
    },
    {
      "reference": "assets/609c8d3a6bb31032f97916a9/03.png",
      "url": "/media/bc803d7ffb223c219887.png",
      "mediaType": "image/png",
      "contentHash": "bc803d7ffb223c21988737186e8537d412109739b3df0978b4a89839cfe905a0",
      "byteLength": 4979,
      "width": 143,
      "height": 132
    },
    {
      "reference": "assets/609c8d3a6bb31032f97916a9/04.png",
      "url": "/media/e340be29a46fa1428791.png",
      "mediaType": "image/png",
      "contentHash": "e340be29a46fa1428791f3faeb15056dbf6bf376e054e2c2bc124ee3e21499ac",
      "byteLength": 4211,
      "width": 237,
      "height": 104
    },
    {
      "reference": "assets/609c8d3a6bb31032f97916a9/05.png",
      "url": "/media/06683ebaff63481a9344.png",
      "mediaType": "image/png",
      "contentHash": "06683ebaff63481a9344310b67a07788a64b14523cfa1fb222b011488fc39ad2",
      "byteLength": 8088,
      "width": 661,
      "height": 39
    },
    {
      "reference": "assets/609c8d3a6bb31032f97916a9/06.png",
      "url": "/media/337b214a077cdd1cde07.png",
      "mediaType": "image/png",
      "contentHash": "337b214a077cdd1cde07a0a0db363361b63c5d603e3702b0e3f57b414fd6754b",
      "byteLength": 6901,
      "width": 630,
      "height": 35
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "TimeLine 的 InternalCreatePlayable 开销很大",
      "anchor": "timeline-的-internalcreateplayable-开销很大",
      "citation": "https://www.pystone.net/notes/uwa-answer-timeline-internal-create-playable-cost/#timeline-%E7%9A%84-internalcreateplayable-%E5%BC%80%E9%94%80%E5%BE%88%E5%A4%A7"
    },
    {
      "depth": 2,
      "text": "问题",
      "anchor": "问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-timeline-internal-create-playable-cost/#%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "我的回答",
      "anchor": "我的回答",
      "citation": "https://www.pystone.net/notes/uwa-answer-timeline-internal-create-playable-cost/#%E6%88%91%E7%9A%84%E5%9B%9E%E7%AD%94"
    },
    {
      "depth": 2,
      "text": "来源与关系",
      "anchor": "来源与关系",
      "citation": "https://www.pystone.net/notes/uwa-answer-timeline-internal-create-playable-cost/#%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-timeline-internal-create-playable-cost/#%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-14：TimeLine 的 InternalCreatePlayable 开销很大（引擎技术）",
      "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": "2021-05-14 - TimeLine 的 InternalCreatePlayable 开销很大",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#%E6%88%91%E7%9A%84uwa%E9%97%AE%E7%AD%94"
    }
  ],
  "contentMarkdown": "# TimeLine 的 Internal_CreatePlayable 开销很大\n\n> [!note] 我的 UWA 问答\n> 本文收录我在 UWA 问答发表的公开回答。问题内容归原提问者；回答保留当时语境，技术结论可能受 Unity 版本、平台和项目条件限制。\n\n## 问题\n\n我们的特效是使用TimeLine进行制作的，最近进行性能测试的时候发现，Internal_CreatePlayable 方法的开销很大，但是只有一个轨道，所以很迷惑这个开销跟什么有关\n\n![OBQVIC13HDF4PR1T05K1.png](assets/609c8d3a6bb31032f97916a9/01.png)\n\n![VV0ERQW46F48AG~8RK`W.png](assets/609c8d3a6bb31032f97916a9/02.png)\n\n- 提问者：张红银\n- 提问时间：2021-05-13 18:21:46\n\n## 我的回答\n\nTimline首次CreatePlayable就是比较耗时，我这边一个简单的Timeline资源首次耗时500+ms。\n\n![image.png](assets/609c8d3a6bb31032f97916a9/03.png)\n\n不过可以通过把CreatePlayable的步骤放在场景加载时进行来避免游戏过程中的卡顿。加载Timeline资源后，调用PlayableDirector.RebuildGraph就会进行CreatePlayable，相当于Prewarm。此后，再调用Play()，就不会进行CreatePlayable。再调用RebuildGraph，由于有了缓存，也不会有高耗时。\n\n![image.png](assets/609c8d3a6bb31032f97916a9/04.png)\n\n下图为首次调用RebuildGraph的耗时。\n\n![image.png](assets/609c8d3a6bb31032f97916a9/05.png)\n\n下图为第二次调用RebuildGraph的耗时。\n\n![image.png](assets/609c8d3a6bb31032f97916a9/06.png)\n\n- 回答时间：2021-05-14 19:51:53\n- 最后更新：2021-05-14 19:51:53\n- 采纳状态：未采纳\n\n## 来源与关系\n\n- 上位集合：[[10-计算机、信息技术与工程/05-游戏图形与运行时/我的UWA问答/我的UWA问答|我的 UWA 问答]]\n- UWA 标签：引擎技术\n- 原始问题：[TimeLine 的 Internal_CreatePlayable 开销很大](https://answer.uwa4d.com/question/609c8d3a6bb31032f97916a9)\n- 源页最后更新：2021-05-14 19:51:53\n"
}
