Upgrade to Pro — share decks privately, control downloads, hide ads and more …

アセット運用ベストプラクティス

unitydojo
August 23, 2016

 アセット運用ベストプラクティス

Unity道場第十回目「アセット運用ベストプラクティス」のスライドです。
http://eventdots.jp/event/596059

unitydojo

August 23, 2016
Tweet

More Decks by unitydojo

Other Decks in Technology

Transcript

  1. 6OJUZ麣㜥

    "TTFU麊欽كأز٥فؙٓذ؍أ

    View full-size slide

  2. ࣗݾ঺հ
    㿊募麦䕕
    ِصذ؍٥ذؙظٗآ٦ؤ٥آٍػٝ
    ؿ؍٦ٕسؒٝآص،Ⱟ

    ؒٞ؋ٝآؑٔأز

    View full-size slide

  3. #Unityಓ৔

    View full-size slide

  4. 6OJUZד،إحز׾ⵃ欽ׅ׷
    㛇燉

    View full-size slide

  5. Ξηοτ(Asset)
    = ࢿ࢈
    ΦʔσΟΦɺςΫενϟɺϞσϧɺΞχϝʔγϣϯ
    ࣭ײɺεΫϦϓτɺͦͷଞॾʑ

    View full-size slide

  6. ͱΓ͋͑ͣֆΛग़͢ɺUnityॳ৺ऀ޲͚આ໌ɻ
    • 6OJUZؒر؍ةך1SPKFDUؽُ٦ח

    ،إحز׾سٓحؚسٗحف

    • ӴӴ؝ٝه٦طٝزךӛӛח

    سٓحؚسٗحف

    • 邌爙ׁ׸׋٧ ӟs

    View full-size slide

  7. Unityͷಈ࡞ͷʮॳ৺ऀ޲͚ͷઆ໌ʯ
    • 6OJUZؒر؍ةך1SPKFDUؽُ٦ח

    ،إحز׾سٓحؚسٗحف

    • ӴӴ؝ٝه٦طٝزךӛӛח

    سٓحؚسٗحف

    • 邌爙ׁ׸׋٧ ӟs

    • ،إحز׾؎ٝه٦ز׃ג

    ⢪ִ׷䕎ח㢌䳔

    • ء٦ٝח،إحز׾ⵃ欽ׅ׷

    ؝ٝه٦طٝز堣腉׾欽䠐
    • ؒر؍ةד؝ٝه٦طٝزח

    ،إحز׾鏣㹀

    • 邌爙ׁ׸׋٧ ӟs

    View full-size slide

  8. Unityͷಈ࡞ͷʮॳ৺ऀ޲͚ͷઆ໌ʯ
    • 6OJUZؒر؍ةך1SPKFDUؽُ٦ח

    ،إحز׾سٓحؚسٗحف

    • ӴӴ؝ٝه٦طٝزךӛӛח

    سٓحؚسٗحف

    • 邌爙ׁ׸׋٧ ӟs

    • ،إحز׾؎ٝه٦ز׃ג

    ⢪ִ׷䕎ח㢌䳔

    • ء٦ٝח،إحز׾ⵃ欽ׅ׷

    ؝ٝه٦طٝز堣腉׾欽䠐
    • ؒر؍ةד؝ٝه٦طٝزח

    ،إحز׾鏣㹀

    • 邌爙ׁ׸׋٧ ӟs

    View full-size slide

  9. ಈతʹࠩ͠ସ͑ΒΕΔResources
    • 3FTPVSDFTؿٕؓت⟃♴חꂁ縧׃׋

    ،إحز׾ծأؙٔفزַ׵《䖤ׅ׷
    • ؿ؋؎ٕせ䭁䓸㶨כ搀׃ד《䖤
    • ٔٔ٦أ䖓ח㢌刿⳿勻זְ

    View full-size slide

  10. ϦϦʔεޙʹมߋग़དྷΔAssetBundle
    • ٔٔ٦أ幥ך،فٔח،إحز׾鷄⸇
    • BTTFU纇׾䎗אַ勲י׋ CVOEMF
    ׮ך
    • 3FTPVSDFTהずׄ״ֲח،إحز׾铣׭׷

    View full-size slide

  11. ͦͷଞɻ
    • +1&(װ1/(ծ#.1瘝ך歗⫷ծ

    8"7װ.1瘝ך،إحزה׃ג涫ꐮ׃ג
    ְזְٔا٦أ׾⹛涸חٗ٦سׅ׷կ
    • ذؗأز׾湫䱸ٗ٦س׃גծ

    㢌䳔׃ג✺ղׅ׷կ

    View full-size slide

  12. ׮ֲ㼰׃鑫׃ֻկ

    View full-size slide

  13. ΞηοτͷΠϯϙʔτ
    • "TTFUTؿٕؓت⟃♴חؿ؋؎ٕ׾ꂁ縧׃

    ،إحز׾؎ٝه٦زׅ׷կ
    • ؎ٝه٦ز׃׋،إحزכծ

    ぐفٓحزؿؓ٦يד铣׭׷ر٦ةח

    㢌䳔ծ؜٦يד⢪ִ׷״ֲחז׷կ
    • ؎ٝه٦ز׃׋،إحزכ4DFOFװ

    1SFGBCח涫ꐮ⳿勻׷״ֲחז׷կ

    View full-size slide

  14. γʔϯϏϡʔʹΞηοτΛઃఆ͢Δɺͱ͸
    • 4DFOFؿ؋؎ٕח؝ٝه٦طٝز׾

    鏣㹀׃ծ،إحزפך⿫撑׾涫ꐮׅ׷կ
    • 䞔㜠כ4DFOFח⥂㶷ׁ׸ծ4DFOF׾

    ٗ٦س׃׋ꥷח،إحز׮荈⹛涸ח

    ٗ٦سׁ׸׷կ
    • 1SPKFDUؽُ٦ַ׵%%דؔـآؙؑز׮⡲䧭
    ׁ׸׷،إحز׮֮׷4QSJUF瘝
    • ؒر؍ةחג✲⵸חء٦ٝח涫ꐮׅ׷կ

    View full-size slide

  15. ResourcesͰϩʔυ͢Δɺͱ͸
    • 㹋遤儗ח3FTPVSDFTؿٕؓتפせ⵸׾欽ְג،ؙإأ׃ծ،إحز׾《䖤ׅ׷կ

    • 《䖤׃׋ⰻ㺁׾أؙٔفزחג

    ؝ٝه٦طٝزח鏣㹀ׅ׷կ
    • 《䖤⳿勻׷ךכ3FTPVSDFTؿٕؓت⟃♴ח

    ろ׭׋،إحزך׫կ
    • ٔٔ٦أ䖓ח䊴׃剏ִ׷✲ָדֹזְ

    View full-size slide

  16. AssetBundle͔Βऔಘ͢Δɺͱ͸
    • 6OJUZָ⢪欽〳腉ז،إحز׾

    ♧א⟃♳呓秛ׅ׷،٦ؕ؎ـ
    • ٔٔ٦أ䖓ח،إحزך鷄⸇٥䊴剏ָ〳腉דծ㹋遤儗ח،إحز׾ٗ٦س׃ג⢪ֲկ
    • "TTFU#VOEMFず㡦ך⣛㶷ꟼ⤘׾邌爙ׅ׷.BOJGFTU

    "TTFU#VOEMFח،إحز׾呓秛ׅ׷"TTFU"TTFUCVOEMF

    "TTFU#VOEMFחء٦ٝ׾呓秛ׅ׷4USFBNFE4DFOF"TTFU#VOEMFָ֮׷կ


    View full-size slide

  17. StreamedSceneAssetBundle
    • 4USFBNFE4DFOF"TTFU#VOEMF

    "TTFU#VOEMFחء٦ٝ׾呓秛׃ծ

    4DFOF.BOBHFSַ׵ㄎן⳿ׇ׷կ
    • "TTFU#VOEMFחכء٦ٝ䞔㜠הծ

    ء٦ָٝ⿫撑ׅ׷،إحز纇ָろת׸׷կ

    View full-size slide

  18. Assetͷґଘؔ܎
    "TTFU#VOEMFַ׵،إحز׾《䖤ׅ׷ꥷծ

    ⿫撑⯓ך"TTFU#VOEMFָٗ٦سׁ׸גְ׸ל

    ➭ך"TTFU#VOEMFָ䭯א،إحز׾ٗ٦س׃גֻ׸׷կ
    JDPO"# QSFGBC"#

    View full-size slide

  19. AssetBundle Manager
    • AssetBundleͷ্ҐϨΠϠʔʢ༧ఆ
    • AssetBundle͔Β

    μ΢ϯϩʔυग़དྷΔ

    View full-size slide

  20. AssetBundle Manager
    • AssetBundleΛϏϧυͤͣAssetBundle͔Β

    ΞηοτΛऔಘ͢ΔγϛϡϨʔλʔػೳ
    • ϩʔΧϧαʔόʔΛߏங͢ΔLocal Serverػೳ
    • ίʔυΛॻ͔ͣAssetBundleΛϏϧυ͢ΔBuildػೳ

    View full-size slide

  21. ،إحز麊欽كأز٥فؙٓذ؍أ

    View full-size slide

  22. كأز٥فؙٓذ؍أ

    剑黝鍑

    View full-size slide

  23. 剑黝鍑כ朐屣ח״׏ג殯ז׷

    View full-size slide

  24. Ⰻגכزٖ٦سؔؿ

    View full-size slide

  25. 剑黝鍑׾濼׷捀חכծ

    ٕ٦ٕה鼅䫛肇׾䪾䳢ׅ׷կ

    View full-size slide

  26. 姻׃ְ鼅䫛肇׾䖤׷捀ח

    View full-size slide

  27. ׮׏ה׮׏ה鑫׃ֻկ

    View full-size slide

  28. ،إحزהؔـآؙؑزך

    ءٔ،ٓ؎ؤחאְג

    View full-size slide

  29. γϦΞϥΠζɺͱ͸
    • ؔـآؙؑزך朐䡾׾⥂㶷ծ

    鷞חؔـآؙؑزח䗁⯋〳腉חׅ׷կ
    • 6OJUZכ،إحزך麊欽ך㣐鿇ⴓ׾

    ֿךءٔ،ٓ؎ؤ䪮遭ח⣛㶷׃גְ׷կ

    View full-size slide

  30. ྫ͑͹PrefabͱSceneͷؔ܎
    圓鸡׾⥂㶷

    View full-size slide

  31. ،إحز
    QSFGBCװTDFOF
    ྫ͑͹ΦϒδΣΫτͱΞηοτͷؔ܎
    ⿫撑䞔㜠׾⥂㶷

    View full-size slide

  32. PrefabΛγϦΞϥΠζ
    ،إحزפך⿫撑
    ،إٝـٔפך⿫撑
    㶨QSFGBC
    ⽃♧ך

    ءٔ،ٓ؎ؤ׃׋ر٦ة

    View full-size slide

  33. PrefabΛσγϦΞϥΠζ
    ،إحزפך⿫撑
    ،إٝـٔפך⿫撑
    㶨QSFGBC
    醱꧟זؔـآؙؑز圓鸡

    View full-size slide

  34. ΞηοτΠϯϙʔτॲཧ΋ɻ
    • Texture΍AudioɺModel౳ωΠςΟϒσʔλΛࢀর͢Δ

    UnityEngine.ObjectΛγϦΞϥΠζʢʹΠϯϙʔτʣ

    View full-size slide

  35. ωΠςΟϒσʔλʁ
    ع٦سؐؑ،ח״׏גؿؓ٦وحزָ

    寸㹀׃גְ׷暟կ
    䭷㹀ךؿؓ٦وحزדזְהծ

    ⵃ欽ׅ׷✲ָדֹזְ
    ⢽ִלQWSUDծFUD瘝ךذؙأثٍر٦ة

    PHHծNQ瘝ךؔ٦ر؍ؔر٦ةկ
    ؿؓ٦وحزכفٓحزؿؓ٦يח⣛㶷ׅ׷ךדծ

    ؙٙٝحءّٝ縧ְկ

    View full-size slide

  36. ΞηοτΠϯϙʔτॲཧ΋ɻ
    • Texture΍AudioɺModel౳ωΠςΟϒσʔλΛࢀর͢Δ

    UnityEngine.ObjectΛγϦΞϥΠζʢʹΠϯϙʔτʣ

    • UnityEngine.ObjectΛܦ༝ͯ͠ɺScene΍Prefab͔Β

    ωΠςΟϒσʔλ΁ؒ઀తʹΞΫηεՄೳʹ͢Δɻ

    View full-size slide

  37. 6OJUZ&OHJOF0CKFDU UFYUVSF
    ،إحز
    ،إحزהر٦ةכ
    Πϯϙʔτ

    View full-size slide

  38. 6OJUZ&OHJOF0CKFDU

    ،إحز UFYUVSF
    QSFGBCװTDFOF
    ط؎ذ؍ـ

    ر٦ة
    ءٔ،ٓ؎ؤ

    朐䡾׾⥂㶷ⱄ植〳腉ח

    View full-size slide

  39. 6OJUZ&OHJOF0CKFDU UFYUVSF
    QSFGBCװTDFOF
    (6*%-PDBM*%

    穗歋ד،ؙإأ
    NFUB
    ࢀরͷྲྀΕʢΤσΟλʣ

    View full-size slide

  40. GUID?
    6OJUZכ،إحز׾陎ⴽׅ׷ꥷծ

    ꅾ醱׃זְ*%(6*%ד،إحز׾

    陎ⴽ׃גְ׷կ
    (6*%כ؎ٝه٦ز儗ח鏣㹀ׁ׸ծ

    NFUBر٦ةָ㣟׻׸זְꣲ׶ծ笝䭯ׁ׸׷
    ػأװؿ؋؎ٕせָ㢌⻉׃ג׮

    ⿫撑ָ㢩׸זְ捀ך倵瘻

    View full-size slide

  41. .meta?
    ،إحز׾؎ٝه٦ز儗ח⡲䧭ׁ׸׷

    ،إحزせNFUBךؿ؋؎ٕկ
    ،إحزהずػأח⡲䧭ׁ׸׷կ
    NFUB׾婍׃׋תתؿ؋؎ٕ׾

    ♳剅ֹׅ׷✲דծ⿫撑װ鏣㹀׾笝䭯׃׋תת
    ،إحز׾刿倜⳿勻׷կ
    ⴱ劍鏣㹀כꦀ׃ؿ؋؎ٕחז׏גְ׷կ

    View full-size slide

  42. Local ID?
    4QSJUFװ.PEFM瘝ծ،إحزכⰻ鿇ח

    醱侧ך،إحز׾䭯א✲ָ֮׷կ
    ׉ְֲ׏׋،إحز纇כծ(6*%הכⴽח

    -PDBM*%חג陎ⴽׅ׷կ
    NFUBח鎸鶢ׁ׸גְ׷

    ך䖓ך侧㶵ָ-PDBM*%

    View full-size slide

  43. ͦͷଞɺGUIDΛׂΓ౰ͯΒΕΔΞηοτ
    • ScriptableObject

    ʢಠࣗͷσʔλܕΛఆٛ͢ΔͨΊͷϑΥʔϚοτɻ

    ɹUnityΤϯδϯ͕γϦΞϥΠζ/σγϦΞϥΠζ͢Δʣ
    • Monobehaviour

    ʢಛఆͷΞηϯϒϦͷ໊લۭؒ.Ϋϥε΁ͷࢀরΛอ࣋͢Δ)

    View full-size slide

  44. את׶ծ6OJUZ&OHJOF0CKFDUדٓحؾؚٝ׃ծ

    ⿫撑ꟼ⤘׾⚵׀ה⥂㶷׃גְ׷կ

    View full-size slide

  45. ،إحزխխխխխכ⡦儗ٗ٦سׁ׸׷ך
    ط؎ذ؍ـر٦ة
    فٖعـ

    View full-size slide

  46. ΞηοτͷϥΠϑαΠΫϧ
    • ωΠςΟϒσʔλ͸UnityEngine.ObjectΛ

    ܦ༝ͯ͠ϩʔυ͞ΕΔɻ
    • ࣮ߦ࣌͸ɺGUIDͱLocal IDΛม׵ͨ͠Instance IDͰ

    ΞηοτΛࢀর͢Δʢߴ଎Խͷҝʣ
    • ෆཁʹͳͬͨΒΞϯϩʔυ͢ΔɻInstance ID͸࢒Δ

    View full-size slide

  47. 6OJUZ&OHJOF0CKFDU
    QSFGBCװTDFOF
    *OTUBODF*%׾ؒٝآٝח涫ꐮ
    ΞηοτͷϥΠϑαΠΫϧ

    View full-size slide

  48. 6OJUZ&OHJOF0CKFDU
    QSFGBCװTDFOF
    *OTUBODF*%穗歋ד

    ،ؙإأ
    ΞηοτͷϥΠϑαΠΫϧ

    View full-size slide

  49. 6OJUZ&OHJOF0CKFDU UFYUVSF
    QSFGBCװTDFOF
    ذؙأثٍ׾ٗ٦س
    ΞηοτͷϥΠϑαΠΫϧ

    View full-size slide

  50. 6OJUZ&OHJOF0CKFDU UFYUVSF
    QSFGBCװTDFOF
    ⿫撑⯋׾搀ֻׅ
    ΞηοτͷϥΠϑαΠΫϧ

    View full-size slide

  51. 6OJUZ&OHJOF0CKFDU UFYUVSF
    ذؙأثٍ׾،ٝٗ٦س

    *OTUBODF*%כ婍׷
    ΞηοτͷϥΠϑαΠΫϧ

    View full-size slide

  52. ΞηοτΛϩʔυ͢ΔγφϦΦ
    • Instance ID͕ࢀর͞ΕΔʢSceneɾPrefab౳͔Βʣ
    • AssetBundle.Load΍Resources.Load౳͔ΒͷΞΫηε

    View full-size slide

  53. ΞηοτΛΞϯϩʔυ͢ΔγφϦΦ
    • Resources.UnloadAssets
    • Resources.UnloadUnusedAssets
    • AssetBundle.Unload(true)
    • SceneManager.LoadScene(LoadSceneMode.Single)

    View full-size slide

  54. Ξϯϩʔυग़དྷͳ͍έʔε
    稢ְַ眔㔲ד،إحز׾⵴ꤐ⳿勻׷6OMPBE"TTFUTװ
    "TTFU#VOEMF6OMPBE USVF
    כ*OTUBODF 醱醡ׁ׸׋
    ،إحزװؔـآؙؑز׾嶊ׇזְկ
    %FTUSPZד嶊ַׅծ-PBE4DFOFד⚵׀ה

    ء٦ٝ׾װ׶湫ׅկ

    View full-size slide

  55. 3FTPVSDFTחאְג

    View full-size slide

  56. Resourcesͷಛ௃
    • ςΩετϕʔεͰInstance IDʹΞΫηε
    • ೚ҙͷΞηοτΛҾ͖ग़ͤΔ
    • ResourcesϑΥϧμҎԼʹ഑ஔͨ͠ΞηοτΛొ࿥

    View full-size slide

  57. Resourcesͷ಺෦ಈ࡞
    • ،فٔ饯⹛儗חⴱ劍⻉Ⳣ椚ָ饥׶ծ

    *OTUBODF*%הؿ؋؎ٕせהؿٕؓتػأ
    ׾ٍؗحءُׅ׷կ
    • ،فٔ饯⹛儗ծ俑㶵⴨،ؙإأך捀ך

    ٕحؙ،حفذ٦ـٕ׾⡲׷կ
    • ⽃♧ךؿ؋؎ٕחءٔ،ٓ؎ؤׁ׸׷կ

    View full-size slide

  58. 3FTPVSDFT
    3FTPVSDFTQSFGBC
    "TTFU NBUFSJBM

    "TTFU UFYUVSF

    "TTFU BOJNBUJPO

    3FTPVSDFTQSFGBC "TTFU NBUFSJBM

    "TTFU UFYUVSF

    View full-size slide

  59. ResourcesͷσϝϦοτ
    • ResourcesϑΥϧμΛෆద੾ʹ࢖͏ͱɺ

    ΞϓϦͷىಈ࣌ؒ΍Ϗϧυ͕࣌ؒ৳ͼΔ
    • ΞηοτΛ௥Ճग़དྷͳ͍ҝɺΧελϜίϯςϯπΛ഑৴ग़དྷͳ͍
    • ࠩ෼ߋ৽͕ग़དྷͳ͍
    • Ξηοτ͸ѹॖ͞Εͳ͍
    • Android͸ΞΫηεʹ௥Ճίετ͕ൃੜ͢Δ

    View full-size slide

  60. ResourcesϑΥϧμΛෆద੾ʹ࢖͏
    3FTPVSDFTؿٕؓت⟃♴חⰋגך،إحز׾
    縧ֻהծ花㣐זⴱ劍⻉Ⳣ椚ָ涪欰ׅ׷կ
    ،إحزך侧ח䘔ׄג

    ٕحؙ،حفذ٦ـٕ׮䎢ָ׷

    /MPH/
    ד

    View full-size slide

  61. "TTFU#VOEMFחאְג

    View full-size slide

  62. AssetBundleͷಈ࡞
    • "TTFU#VOEMF׾ٗ٦سׅ׷הծ
    "TTFU#VOEMFⰻחろת׸׷،إحزך
    *OTUBODF*%ָ铣׫鴥ת׸׷կ
    • "TTFU#VOEMF׾騖ְ׌⣛㶷ꟼ⤘׾

    鏣㹀ׅ׷✲ָ⳿勻׷կ
    • "TTFU#VOEMFך䭯אط؎ذ؍ـر٦ةפ

    *OTUBODF*%׾穗歋׃ג،ؙإأ
    "QQ "TTFU#VOEMF
    JOTUBODF*%T

    姻然חכ*OTUBODF*%׾⡲׷暟
    /BUJWF%BUB

    0CKFDUT

    View full-size slide

  63. AssetBundleͷಈ࡞
    • "TTFU#VOEMF׾ٗ٦سׅ׷הծ
    "TTFU#VOEMFⰻחろת׸׷،إحزך
    *OTUBODF*%ָ铣׫鴥ת׸׷կ
    • "TTFU#VOEMF׾騖ְ׌⣛㶷ꟼ⤘׾

    鏣㹀ׅ׷✲ָ⳿勻׷կ
    • "TTFU#VOEMF׾6OMPBEׅ׷הծ

    *OTUBODF*%ָ㣟׻׸׷կ
    • 3FTPVSDFTהず圫ծ湫䱸⿫撑׃גְ׷،
    إحزך侧ח״׶ծ俑㶵،ؙإأ欽ך

    ٕحؙ،حفذ٦ـָٕ䎢ָ׷կ
    • "TTFU#VOEMF㔐חאֹ։LCך

    ًٌٔ嶊顤ה⫦ַזָ׵㾜Ꟛך

    ؔ٦غ٦قحسָ֮׷

    View full-size slide

  64. AssetBundleͷಈ࡞
    • "TTFU#VOEMF׾ٗ٦سׅ׷הծ
    "TTFU#VOEMFⰻחろת׸׷،إحزך
    *OTUBODF*%ָ铣׫鴥ת׸׷կ
    • "TTFU#VOEMF׾騖ְ׌⣛㶷ꟼ⤘׾

    鏣㹀ׅ׷✲ָ⳿勻׷կ
    • "TTFU#VOEMF׾6OMPBEׅ׷הծ

    *OTUBODF*%ָ㣟׻׸׷կ
    • 3FTPVSDFTהず圫ծ湫䱸⿫撑׃גְ׷،
    إحزך侧ח״׶ծ俑㶵،ؙإأ欽ך

    ٕحؙ،حفذ٦ـָٕ䎢ָ׷կ
    • "TTFU#VOEMF㔐חאֹ։LCך

    ًٌٔ嶊顤ה⫦ַזָ׵㾜Ꟛך

    ؔ٦غ٦قحسָ֮׷

    View full-size slide

  65. AssetBundleͷґଘؔ܎
    ➭ך"TTFU#VOEMFח⣛㶷׃גְ׷㜥さծ

    *OTUBODF*%׾⯋ח⿫撑׾鍑寸ׅ׷կ
    ⣛㶷⯓ך*OTUBODF*%ָ鋅אַ׵זְ㜥さծ

    .JTTJOHח鏣㹀ׁ׸׷կ
    NJTTJOH䖓ד׮*OTUBODF*%ָ鍑寸ׁ׸׸ל

    ⣛㶷ꟼ⤘כ䗁崞ׅ׷կ

    View full-size slide

  66. AssetBundleͷґଘؔ܎
    "TTFU#VOEMF׾6OMPBEׅ׷הծ*OTUBODF*%
    ׾1FSTJTUFOU.BOBHFSַ׵《׶♴־׷կ
    ♧䏝《׶♴־׋*OTUBODF*%כ䗁崞⳿勻׆ծ
    ⱄٗ٦س儗ח倜׃ְ*OTUBODF*%ָⶴ׶䮶׵
    ׸׷կ
    ⿫撑⯓׾6OMPBE׃׋㜥さծ⿫撑⯋׮6OMPBE
    ׃ⱄ䏝-PBEׅ׷䗳銲ָ֮׷կ

    View full-size slide

  67. AssetBundle.Unload
    "TTFU#VOEMF6OMPBE USVF

    "TTFU#VOEMFַ׵䲿⣘׃׋Ⰻגך

    *OTUBODF*%׾䭯א،إحز׾䓼ⵖ涸ח

    Ꟛ佝׃ծ*OTUBODF*%׮⵴ꤐׅ׷կ
    "TTFU#VOEMF6OMPBE GBMTF

    "TTFU#VOEMFַ׵䲿⣘׃׋*OTUBODF*%

    ׾⵴ꤐׅ׷կ

    View full-size slide

  68. AssetBundleͷಈ࡞
    • "TTFU#VOEMF׾ٗ٦سׅ׷הծ
    "TTFU#VOEMFⰻחろת׸׷،إحزך
    *OTUBODF*%ָ铣׫鴥ת׸׷կ
    • "TTFU#VOEMF׾騖ְ׌⣛㶷ꟼ⤘׾

    鏣㹀ׅ׷✲ָ⳿勻׷կ
    • "TTFU#VOEMF׾6OMPBEׅ׷הծ

    *OTUBODF*%ָ㣟׻׸׷կ
    • 3FTPVSDFTהず圫ծ湫䱸⿫撑׃גְ׷،
    إحزך侧ח״׶ծ俑㶵،ؙإأ欽ך

    ٕحؙ،حفذ٦ـָٕ䎢ָ׷կ
    • "TTFU#VOEMF㔐חאֹ։LCך

    ًٌٔ嶊顤ה⫦ַזָ׵㾜Ꟛך

    ؔ٦غ٦قحسָ֮׷

    View full-size slide

  69. AssetBundleͷ෼ׂ਺
    -;."ך㜥さծ؟؎ؤָ㣐ְֹהꬊ䌢ח

    ꞿְٗ٦ر؍ؚٝ儗꟦ָ涪欰ׅ׷կ
    $BDIF0S%PXOMPBEךٍؗحءُ׾ⵃ欽ׅ׷✲
    ד넝鸞דٗ٦سָ〳腉חז׷ָծ

    侧ָ㢳ֺׅ׷ה饯⹛儗ח頾蚚חז׷կ
    -PBE"MM"TTFUTכך،إحز׾♧䭍ד铣׬ז
    ׵לծ鷵如ٗ٦س״׶׮傍ְַ׮׃׸זְկ

    View full-size slide

  70. AssetBundleͷ෼ׂ਺
    "TTFU#VOEMFך侧ָ㼰זְ
    • ًٌٔ⢪欽ꆀָ㟓ִ׷

    NFNPSZ瘝ד铣׬ה
    • 铣鴥儗꟦ָ⠼ן׷

    M[NBד铣׬ה
    • "TTFU#VOEMFךؽٕس儗ծ

    ⱄ圓眠ך堣⠓ָ㟓ִ׷
    "TTFU#VOEMFך侧ָ㢳ְ
    • ؽٕسח儗꟦ַַָ׷
    • ٔا٦أوطآًٝزָꬊ䌢ח醱꧟
    • تؐٝٗ٦س儗꟦ָ⠼ן׷

    醱侧ךؿ؋؎ٕ׾糺׭גְזְ㜥さ

    View full-size slide

  71. ҉໧ͷࢀরͱॏෳΞηοτ
    • AssetBundle͸௚઀assetbundle nameΛࢦఆ͠ͳ͍

    Ξηοτ΋AssetBundleʹؚΊΔɻ
    • طʹInstance IDׂ͕ΓৼΒΕ͍ͯͨ৔߹ɺ

    ৽͘͠Instance IDΛׂΓৼΒΕΔɻ

    View full-size slide

  72. "TTFU#VOEMF
    "TTFU#VOEMF
    ⴽך*OTUBODF*%ָ

    ⶴ׶䮶׵׸׷

    View full-size slide

  73. SFTPVSDF"TTFU#VOEMF
    "TTFU#VOEMF
    "TTFU#VOEMF

    View full-size slide

  74. AssetBundleͷѹॖ
    ꬊ㖇簭
    -;
    -;."

    View full-size slide

  75. AssetBundleͷѹॖ
    • ඇѹॖɿѹॖ͠ͳ͍ҝɺϑΝΠϧαΠζ͸େ͖͍ɻ

    ɹɹɹɹμ΢ϯϩʔυग़དྷΕ͹ΞΫηε͸࠷଎ɻ
    • LZ4ɹɿLZMAฒͷߴ͍ѹॖ཰ͱɺඇѹॖฒͷղౚ଎౓ɻ

    ɹɹɹɹUnity 5.3Ҏ߱ʹ࢖༻Մೳɻ
    • LZMAɿ࠷΋ߴ͍ѹॖ཰ɻ࠷΋஗͍ղౚ଎౓ɻ

    ɹɹɹղౚ͢Δʹ͸ɺҰ୴શͯϝϞϦʹల։͢Δඞཁ͕͋Δɻ

    View full-size slide

  76. AssetBundleͷಡࠐ
    • AssetBundle.LoadFromFile
    • AssetBundle.LoadFromMemory

    (WWW.assetBundle)
    • WWW.CacheOrDownload

    View full-size slide

  77. AssetBundleͷಡࠐ
    • AssetBundle.LoadFromFile
    • چ໊CreateFromFile
    • ϔομΛಡΈɺϩʔΧϧετϨʔδ΁௚઀ΞΫηε͢Δɻ
    • ※ΤσΟλ͸LoadFrommemoryAsyncͷΑ͏ͳಈ࡞Λߦ͏ҝɺ

    ɹएׯͷΦʔόʔϔου͕͋Δɻ
    • LZMAΛಡΉ৔߹ɺLoadFromMemoryͱಉ༷ͷಈ࡞ɻ

    View full-size slide

  78. 0
    30
    60
    90
    120
    ඇѹॖ LZ4 LZMA
    ϔομʔ AssetBundle Ξηοτ
    -PBE'SPN'JMFT

    View full-size slide

  79. AssetBundleͷಡࠐ
    • AssetBundle.LoadFromMemory
    • چ໊CreateFromMemory
    • ϝϞϦ͔ΒAssetBundleΛߏங͠ɺϩʔυ͢Δ
    • LZ4ͷ৔߹ɺϝϞϦʹͦͷ··ίϐʔ͢Δɻ

    LZMAͷ৔߹ɺશͯղౚ͠LZ4΁࠶ѹॖ͢Δʢ5.3Ҏ߱ʣ
    • AssetBundleΛ҉߸Խ͢Δ৔߹ʹͷΈ͓קΊ

    View full-size slide

  80. 0
    75
    150
    225
    300
    ඇѹॖ LZ4 LZMA
    ϔομʔ AssetBundle ΤϯδϯϝϞϦ Ξηοτ
    -PBE'SPN.FNPSZ

    View full-size slide

  81. 0
    100
    200
    300
    400
    ඇѹॖ LZ4 LZMA
    ϔομʔ WWW AssetBundle ΤϯδϯϝϞϦ
    Ξηοτ
    888BTTFU#VOEMF

    View full-size slide

  82. AssetBundleͷಡࠐ
    • WWW.CacheOrDownload
    • ΞηοτΛμ΢ϯϩʔυ͠ɺUnityͷΩϟογϡγεςϜͰΩϟογϡ͢Δ
    • LZ4ٴͼແѹॖͷ৔߹ɺϝϞϦʹͦͷ··อଘ͢Δ

    LZMAͷ৔߹ɺղౚ͠LZ4΁࠶ѹॖ͢Δʢ5.3Ҏ߱ʣ
    • ىಈ࣌ʹΩϟογϡͷ༗ແ΍࡟আ൑ఆΛߦ͏
    • 2ճ໨Ҏ߱͸Ωϟογϡ͔Βऔಘ͢Δ

    View full-size slide

  83. 0
    75
    150
    225
    300
    ඇѹॖ LZ4 LZMA
    ϔομʔ AssetBundle ΤϯδϯϝϞϦ Ξηοτ
    $BDIF0S%PXOMPBEⴱ㔐

    View full-size slide

  84. 0
    15
    30
    45
    60
    ඇѹॖ LZ4 LZMA
    ϔομʔ ΤϯδϯϝϞϦ Ξηοτ
    $BDIF0S%PXOMPBEٍؗحءُ״׶《䖤

    View full-size slide

  85. AssetBundleͷಡࠐ
    • UnityWebRequest & DownloadHandler
    • AssetBundleΛϩʔΧϧετϨʔδʹμ΢ϯϩʔυ͠ɺΩϟογϡ͢Δɻ
    • LZ4ͷ৔߹ɺϝϞϦʹͦͷ··ίϐʔ͢Δɻ

    LZMAͷ৔߹ɺશͯղౚ͠LZ4΁࠶ѹॖ͢Δʢ5.3Ҏ߱ʣ
    • WWW.CacheOrDownloadͱൺֱ͠ɺσʔλͷॲཧΛࢦఆ͢Δ͜ͱͰώʔϓΛ཈͑ΒΕΔ

    View full-size slide

  86. 0
    17.5
    35
    52.5
    70
    ඇѹॖ LZ4 LZMA
    ϔομʔ WebRequest Ξηοτ
    -PBE'SPN.FNPSZ

    View full-size slide

  87. AssetBundleͷΞηοτͷಡΈࠐΈ
    • LoadAsset
    • LoadAllAssets
    • LoadAssetWithSubAssets
    • AsyncΛ෇͚Δͱඇಉظ

    View full-size slide

  88. AssetBundleͷΞηοτͷಡΈࠐΈ
    • LoadAsset

    ୯ҰͷΞηοτΛऔΓग़͢
    • LoadAllAssets

    AssetBundle͕಺แ͢Δɺ௚઀ࢀরՄೳͳΞηοτΛશͯऔΓग़͢

    શମͷ2/3Λ࢖༻͢Δ৔߹ɺLoadAssetΑΓޮ཰త
    • LoadAssetWithSubAssets

    αϒΞηοτʢLocalIDͷؔΘΔΞηοτʣΛऔΓग़͢

    View full-size slide

  89. AssetBundleͷΞηοτͷಡΈࠐΈʢඇಉظʣ
    • AsyncΛઃఆ͢ΔͱɺΞηοτͷಡࠐΛ

    ϫʔΧʔεϨουͰߦ͏ɻ
    • 1ϑϨʔϜͷॲཧ࣌ؒ͸ThreadPriorityͰઃఆ

    High- ࠷େ50ϛϦඵɺNormal - 10ϛϦඵ

    BelowNormal - 4ϛϦඵɺLow - 2ϛϦඵ

    View full-size slide

  90. AssetBundleͷΞηοτͷಡΈࠐΈʢඇಉظʣ
    • 5.1Ͱ͸ɺ1ϑϨʔϜ1Ξηοτͱ͍͏Ṗಈ࡞Λ͍ͯͨ͠ɻ

    ʢͦͷҝɺϩʔυ͢ΔΞηοτʹΑͬͯఀࢭ࣌ؒʹόϥ͖͕ͭ͋ͬͨʣ
    • 5.2·Ͱ͸ɺLoadAllAssetsAsyncͱLoadAssetWithSubAssetAsync͕େ෯
    ʹ஗͍ෆ۩߹͕͋ͬͨɻ
    • 5.3͔ΒUnityEngine.Objectͷϩʔυ΋ϫʔΧʔεϨουͰ࣮ߦ͢Δɻ

    ฒྻҰׅͰॲཧ͠ɺϩʔυ׬ྃޙʹAwake͕ݺ͹ΕΔɻ

    View full-size slide

  91. ಺ଂΩϟογϡγεςϜ
    • LoadFromCacheOrDownload΋͘͠͸
    DownloadHandlerAssetBundleΛ࢖༻͢Δͱɺ

    ಺ଂΩϟογϡγεςϜΛ࢖༻͢Δɻ
    • LZMAΛΩϟογϡ͢ΔࡍɺLZ4΁࠶ѹॖ͢Δࣄ͕Ͱ͖Δɻ
    • Ωϟογϡͨ͠AssetBundle͸ɺLoadFromFilesͰ

    ௿ίετͰΞΫηεग़དྷΔɻ

    View full-size slide

  92. ಺ଂΩϟογϡγεςϜͷಈ࡞
    • 䭷㹀ך"TTFU#VOEMFָ֮׸לٍؗحءַُ׵《䖤׃ծ搀ֽ׸לتؐٝٗ٦سׅ׷կ

    ⡎׃ծغ٦آّٝ׾♳־ג׮傊غ٦آّٝ׾⵴ꤐ׃זְկ
    • Ωϟογϡͷॲཧ͸ϫʔΧʔεϨουͰߦ͏ɻ
    • ෳ਺Λಉ࣌ʹ૸ΒͤΔͱOSͷಉ࣌ΞΫηεݶք਺ʹୡ͢ΔʢಛʹϞόΠϧʣ

    View full-size slide

  93. ಺ଂΩϟογϡγεςϜͷಈ࡞
    • 饯⹛儗חٍؗحءُך剑穄⢪欽傈׾然钠׃גծ

    劢⢪欽劍꟦ָ䭷㹀劍꟦׾麓ֺגְ׸ל⵴ꤐׅ׷կ
    • أزٖ٦آָ♧匈חז׷הծ劢⢪欽ך،إحزַ׵⵴ꤐׅ׷կ
    • "TTFU#VOEMFך陎ⴽכؿ؋؎ٕせ
    • 䭷㹀ך"TTFU#VOEMF׾僇爙涸ח⵴ꤐׅ׷"1*ָ搀ְ

    铎׏׋DSD׾䭷㹀ׅ׷ה⵴ꤐׁ׸׷

    View full-size slide

  94. ಺ଂΩϟογϡγεςϜ
    ًٔحز
    -;."׾تؐٝٗ٦س׃׋㜥さד׮ծ

    խ-;׾⢪欽⳿勻׷կ
    ה׶ִ֮׆⢪ִ׷
    رًٔحز
    - 稢ְַ،إحز盖椚ָדֹזְկ
    - ،إحزָ㟓ִֺׅ׷הծ،إحزך剣搀
    ثؑحؙ瘝ד儗꟦ַַָ׷կ

    View full-size slide

  95. ΩϟογϡγεςϜΛࣗ࡞͢Δ৔߹
    • WWWΫϥε͸bytesΞΫηε༻ʹʢΤϯδϯଆ͕ʣ

    ϝϞϦΛ֬อ͍ͯ͠ΔҝɺϝϞϦΛ༨ܭʹ࢖͏ɻ
    • ਪ঑
    • HttpWebRequest ɹ(PC͸ݱࡏHTTPSΛ࢖͑ͳ͍ʣ
    • ωΠςΟϒϓϥάΠϯ

    ʢΦϯσϚϯυϦιʔε(iOS)ɾDownloadManager(android)

    ɹNSURLConnection(iOS) ɾjava.net.HttpURLConnection(Androidʣ)

    View full-size slide

  96. ،إحز麊欽كأز٥فؙٓذ؍أ

    ⟎

    View full-size slide

  97. ಉҰͷཁૉΛେྔʹؚΜͩPrefab͸ආ͚Δ
    • ΦϒδΣΫτ͸શͯͦͷ··γϦΞϥΠζ͞ΕΔҝɻ
    • ྫ͑͹ಉҰͷPrefabΛ30ݸίϐʔͯ͠ϦετϏϡʔΛ
    ࡞ͬͨ৔߹ɺಉ͡σʔλΛ30ճσγϦΞϥΠζ͢Δɻ
    • ୯ҰͷPrefabΛInstantiateΛ࢖༻ͯ͠

    ෳ੡ͨ͠ํ͕ɺएׯޮ཰తɻ

    View full-size slide

  98. Resources
    • Resources/AssetBundleʹ͸ɺ

    ௚઀ࢀর͠ͳ͍Ξηοτ͸ؚΊͳ͍ɻ
    • ResourcesͷΞηοτ͸ग़དྷΕ͹ݮΒ͢ɻ

    View full-size slide

  99. ResourcesΛ࢖Θͳ͍ʢUnityࣾ಺ͷ͓קΊʣ
    • Resources͸ϓϩτλΠϓ༻ͱׂΓ੾Δ
    • ৗʹΞΫηε͢Δඞཁ͕͋ΔɺΞηοτʹͷΈ࢖͏

    View full-size slide

  100. ResourcesΛ࢖Θͳ͍…ʢͲ͏͢ΜͶΜ…ʣ
    ،فٔח"TTFU#VOEMF׾ろ׭ג׃תֲկ

    4USFBNJOH"TTFUT瘝
    "OESPJEכBQLⰻ[JQⰻח4USFBNJOH"TTFUTָ֮׶
    -PBE'SPN'JMFד،ؙإأ⳿勻זְ׋׭ծ
    $BDIF0S%PXOMPBEװ⡦׵ַך䩛ד《׶⳿ׅկ
    పఈ͢Δ͜ͱͰɺ։ൃΛ໘౗ʹग़དྷΔɻ

    ʢResourcesΛ࢖༻͢Δͷͱൺֱͯ͠ʣ

    View full-size slide

  101. AssetBundleͷ෼ׂ
    • ࿦ཧΤϯςΟςΟ
    • λΠϓͷάϧʔϓ
    • ಉ࣌ίϯςϯπͷάϧʔϐϯά
    • 1Asset 1AssetBundle
    • Ұͭʹ߆ΒͣɺέʔεόΠέʔεͰ࢖͍෼͚Δ

    View full-size slide

  102. AssetBundleͷ෼ׂ
    • ࿦ཧΤϯςΟςΟ
    • DLC౳ʹ࢖͍΍͍͢ϑΥʔϚοτ
    • ϨΠΞ΢τ΍UI
    • ΩϟϥΫλʔ
    • ڞ༗͢ΔഎܠͷϞσϧ΍ςΫενϟ

    View full-size slide

  103. AssetBundleͷ෼ׂ
    • λΠϓͷάϧʔϓ
    • ಉλΠϓͷΞηοτʢTexture΍AudioʣΛҰͭʹ·ͱΊΔ
    • ਺͕গͳ͘ɺϩʔΧϧ͔Β઀ଓ͢ΔͳΒجຊܨ͗ͬͺͳ͠ͰOK

    View full-size slide

  104. AssetBundleͷ෼ׂ
    • ಉ࣌ʹ࢖༻͢ΔίϯςϯπͰάϧʔϐϯά
    • ඞཁʹͳΔΞηοτΛɺඞཁͳ෼͚ͩϩʔυ͢Δɻ
    • SceneΛAssetBundleԽ͓ͯ͘͠࢖͍ํ
    • Կ౓΋࢖༻͢ΔΞηοτ͸෼ׂ͢Δ
    • ଟগͷΞηοτͷॏෳ͸ؾʹ͠ͳ͍

    View full-size slide

  105. AssetBundleͷ෼ׂ
    • ̍Ξηοτ̍Ξηοτόϯυϧ
    • ݸผʹΞηοτΛऔಘ͢Δ
    • ΧʔυήʔϜ౳Ͱ༗ར
    • ґଘؔ܎ͷղܾ͸εΫϦϓτͰߦ͏
    • γΣʔμʔ౳ͷ҉໧ͷϩʔυΛݟམͱ͢ͱ༨ܭͳίετ͕ग़Δࣄ͕͋Δ
    • 5.3ະຬͰAssetBundleΛ࢖༻͢Δ৔߹͸࠷దղ͔΋͠Εͳ͍

    ʢLZMA͕େ͖ͳαΠζͰۃ୺ʹ஗͘ͳΔҝʣ

    View full-size slide

  106. ґଘઌAssetBundle͸Unload͠ͳ͍
    • Ξηοτͷ։์ͷΈΛߦ͍ɺAssetBundle͸ҡ࣋͢Δɻ
    • Ξηοτͷෳ੡ʹΑΔϝϞϦɾϩʔυίετΛ๷͙
    • Loadҡ࣋ʹ΋ίετ͕͋ΔͷͰɺέʔεόΠέʔεͰɻ
    • ෼ׂ਺ʹ΋ґΔ

    View full-size slide

  107. AssetBundle͸ͲͷѹॖΛ࢖͏΂͖͔
    • ϩʔυ଎౓Λ্͍͛ͨ৔߹ɿɹඇѹॖʢ࠷଎ʣ LZ4ʢόϥϯεʣ
    • Ϗϧυ͕࣌ؒ໰୊ͳ৔߹ɹɿɹඇѹॖʢѹॖॲཧ͕ແ͍ʣ
    • ΞϓϦαΠζ͕໰୊ͳ৔߹ɿɹLZMAʢѹॖ཰࠷ߴʣ
    • ࢖༻ϝϞϦ͕໰୊ͳ৔߹ɹɿɹLZ4 or ඇѹॖ
    • ௨৴͕࣌ؒ໰୊ͳ৔߹ɹɹɿɹLZMAʢཁCacheOrDownloadܥ)

    View full-size slide

  108. AssetBundleͷμ΢ϯϩʔυ͸Ͳ͏΍Δʁ
    • 5.3Ҏ߱͸WebRequest͕͓קΊ
    • WWW͸ආ͚Δ
    • CacheOrDownloadΛ࢖͏ͳΒ͹ɺ

    ώʔϓ͕๲ΒΈա͗ͳ͍Α͏ʹ͢Δɻ

    View full-size slide

  109. ʮϕετϓϥΫςΟεʯΛ৴͡ͳ͍
    • ؀ڥ΍ήʔϜʹΑͬͯ࠷దղ͸ҟͳΔɻ

    View full-size slide

  110. ʮϕετϓϥΫςΟεʯΛ৴͡ͳ͍
    • ؀ڥ΍ήʔϜʹΑͬͯ࠷దղ͸ҟͳΔɻ
    • Stay alert! Trust no one! Keep your laser handy!

    View full-size slide