Democratized Unity Package Manager

Democratized Unity Package Manager

2019/07/20 (Sat) に開催された「Unity++ 〜ショートセッション勉強会 presented by Unity部〜」の登壇資料です。
https://meetup.unity3d.jp/jp/events/1112

7b13f432547b92d04c79b749adb535e0?s=128

Tetsuya Mori

July 20, 2019
Tweet

Transcript

  1. גࣜձࣾΩοζελʔ$50 ৿ɹ఩࠸ %FNPDSBUJ[FE 6OJUZ1BDLBHF.BOBHFS  4BU 6OJUZ ʙγϣʔτηογϣϯษڧձQSFTFOUFECZ6OJUZ෦ʙ ʙ৐Δ͔͠ͳ͍ʂຽओԽͷϏοά΢Σʔϒʹʂʂʙ VOJUZ@QQ

  2. ͜Μʹͪ͸ʂ  

  3. wηογϣϯ֓ཁ w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w1BDLBHFΛ࢖͏ w1BDLBHFΛ࡞Δ w1BDLBHFΛެ։͢Δ w·ͱΊ   ΞδΣϯμ

  4. wηογϣϯ֓ཁ w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w1BDLBHFΛ࢖͏ w1BDLBHFΛ࡞Δ w1BDLBHFΛެ։͢Δ w·ͱΊ   ΞδΣϯμ ΠϚίί

  5.   ࠓ೔ͷߨԋʹ͍ͭͯ ηογϣϯ֓ཁ εϥΠυ ಈը 6OJUZ-FBSOJOH.BUFSJBMT
 ʹͯެ։༧ఆ

  6. ηΫγϣϯλΠτϧ 6 ࠓ೔ͷߨԋʹ͍ͭͯ 6/*#00,
 ʹৄࡉΛدߘ͠·͢ $݄༵೔ ೔໨  ೆϦB ʹͯ൦෍༧ఆ

    ηογϣϯ֓ཁ
  7. w"TTFU4UPSF࢖͍ͮΒ͍ͳ͊ʜɻ wࣗ࡞ϥΠϒϥϦΛ΋ͬͱ؆୯ʹެ։͠ ͍ͨΜ͚ͩͲͳ͊ʜɻ wࣾ಺ϥΠϒϥϦͷ؅ཧ͕γϯυΠʜɻ   ࠓ೔ͷର৅ऀ ηογϣϯ֓ཁ

  8. w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w4DPQFE3FHJTUSZΛ༻͍ͨ 1BDLBHF؅ཧ   ࠓ೔࿩͢ίτ ηογϣϯ֓ཁ

  9. w"TTFU4UPSFʹؔͯ͠ w4DPQFE3FHJTUSZͷݐͯํ w6/*#00,ങͬͯͶʂ   ࠓ೔࿩͞ͳ͍ίτ ηογϣϯ֓ཁ

  10. ηΫγϣϯλΠτϧ w࢓ࣄגࣜձࣾΩοζελʔ$50 wՈ଒࠺ɾ່ʢ೔ޙʹࡀʣ w6OJUZྺ೥໨ w!NPOSZ wBLB΋ΜΓ͌ઌੜ 10 ࣗݾ঺հ ηογϣϯ֓ཁ

  11.   ࣗݾ঺հ"XBSE ηογϣϯ֓ཁ w.JDSPTPGU.71
 GPS%FWFMPQFS5FDIOPMPHJFT w6OJUZ"NCBTTBEPS

  12.   ࣗݾ঺հ+PC ηογϣϯ֓ཁ ະबֶࣇʙখֶߍ௿ֶ೥޲͚ͷ ৬ۀମݧΞϓϦʮͬ͜͝ϥϯυʯΛ ೥Ҏ্ʹΘͨΓ։ൃɾӡӦ

  13. ηΫγϣϯλΠτϧ wΩοζελʔֶशா
 1JYJW#005)ʹͯ
 ޷ධൢചதʂ w"TTFU#VOEMF w։ൃൿ࿩ wւ֎ۈ຿ͷ͓࿩͠ wษڧձ։࠵ w"OESPJEࣗಈςετ w7FDUPS(SBQIJDT

    13 ࣗݾ঺հ13 IUUQTLJETTUBSUCGCPPUIQN ηογϣϯ֓ཁ
  14.   ࣗݾ঺հ13 ηογϣϯ֓ཁ #΋ͷϥδ ύʔιφϦςΟ΍ͬͯ·͢ʂ ήετืूதʂ

  15. wηογϣϯ֓ཁ w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w1BDLBHFΛ࢖͏ w1BDLBHFΛ࡞Δ w1BDLBHFΛެ։͢Δ w·ͱΊ   ΞδΣϯμ ΠϚίί

  16. 6OJUZ1BDLBHF.BOBHFS ͷ֓ཁ  

  17.   ֓ཁ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  18. w6OJUZͷެࣜػೳ΍ϥΠϒϥϦɾ
 Ξηοτ܈ͷґଘΛ؅ཧ͢Δ࢓૊Έ wػೳࣗମ͸6OJUZͰొ৔ w6OJUZͰେ෯ػೳ௥Ճ   ֓ཁ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  19. w6OJUZ1BDLBHF.BOBHFS6* w1BDLBHF w3FHJTUSZ w4DPQFE3FHJTUSZ wPackages/manifest.json wAssets/package.json   جຊཁૉ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  20. w6OJUZ1BDLBHF.BOBHFS6* w1BDLBHF w3FHJTUSZ w4DPQFE3FHJTUSZ wPackages/manifest.json wAssets/package.json   جຊཁૉ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  21.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ Window > Package Manager

  22.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  23.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ Ұཡʹͳ͍ Package Λखಈ௥Ճ

  24.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ Ұཡ͢Δ Package ͷΧςΰϦΛมߋ

  25.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ ͦͷଞ্ڃऀ޲͚ϝχϡʔ

  26.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ ݕࡧ૭

  27.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ Package Ұཡ

  28.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ Package ৄࡉ

  29.   6OJUZ1BDLBHF.BOBHFS6* 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ Package ૢ࡞Ϙλϯ

  30. w6OJUZ1BDLBHF.BOBHFS6* w1BDLBHF w3FHJTUSZ w4DPQFE3FHJTUSZ wPackages/manifest.json wAssets/package.json   جຊཁૉ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  31. w6OJUZ1BDLBHF.BOBHFS͕औΓѻ͏ཁૉͷ࠷খ୯Ґ w"EESFTTBCMFT ެࣜ7FSJpFE  w$IJOFNBDIJOF ެࣜ7FSJpFE  w%4QSJUF4IBQF ެࣜ1SFWJFX 

    w6OJ3Y ඇެࣜ  w;FOKFDU ඇެࣜ  wFUDʜ   1BDLBHF 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ
  32. wެࣜ7FSJpFE wެࣜ1SFWJFX wެࣜ#VJMUJO wඇެࣜ   1BDLBHFछผ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  33. 1BDLBHF/BNF ϢχʔΫͳ1BDLBHF*% 3FWFSTF%PNBJOه๏ 7FSTJPO 4FN7FSܗࣜ 1SFWJFX͔Ͳ͏͔΋؅ཧ 6OJUZ7FSTJPO αϙʔτ͢Δ6OJUZͷ
 ࠷௿όʔδϣϯ %FQFOEFODJFT

    1BDLBHF͕ґଘ͢Δ ଞͷ1BDLBHFͱ7FSTJPO   1BDLBHFଐੑ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ
  34. w6OJUZ1BDLBHF.BOBHFS6* w1BDLBHF w3FHJTUSZ w4DPQFE3FHJTUSZ wPackages/manifest.json wAssets/package.json   جຊཁૉ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  35. w1BDLBHF͕ొ࿥͞Ε͍ͯΔαʔό wOQN3FHJTUSZ࢓༷ʹ४ڌ whttps://packages.unity.com/ whttps://staging-packages.unity.com
 ͱ͍͏ࢼݧత1BDLBHF༻3FHJTUSZ΋͋Δ   3FHJTUSZ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  36. w6OJUZ1BDLBHF.BOBHFS6* w1BDLBHF w3FHJTUSZ w4DPQFE3FHJTUSZ wPackages/manifest.json wAssets/package.json   جຊཁૉ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  37. w1BDLBHF/BNFͷείʔϓຖʹ
 3FHJTUSZΛ੾Γସ͑Δػೳ w7FSEBDDJPͱ͍͏044Λ࢖͏ͱ؆ ୯ʹݐͯΒΕΔ w(JU)VC1BDLBHF3FHJTUSZ΋
 ظ଴͕࣋ͯͦ͏   4DPQFE3FHJTUSZ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  38.   4DPQFE3FHJTUSZ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ packages.unity.com Timeline Project A Addressable uGUI

    my-packages.com UniRx Zenject SugoiUtil upm.kidsstar.co.jp Shaders Fonts OreOre UniRx Project B
  39. w6OJUZ1BDLBHF.BOBHFS6* w1BDLBHF w3FHJTUSZ w4DPQFE3FHJTUSZ wPackages/manifest.json wAssets/package.json   جຊཁૉ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  40. wϓϩδΣΫτͷ৘ใΛ؅ཧ wར༻͢Δ3FHJTUSZ wར༻͢Δ4DPQFE3FHJTUSZ wґଘ͢Δ1BDLBHF   manifest.json 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  41. w6OJUZ1BDLBHF.BOBHFS6* w1BDLBHF w3FHJTUSZ w4DPQFE3FHJTUSZ wPackages/manifest.json wAssets/package.json   جຊཁૉ 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  42. w1BDLBHFͷ৘ใΛ؅ཧ w1BDLBHF/BNF w7FSTJPO wґଘ͢Δ1BDLBHF wFUDʜ   package.json 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  43. wجຊతʹ͸OQNͷ࢓༷ʹ४ڌ wҰ෦6OJUZ༻ͷಠ֦ࣗு͋Γ w1BDLBHFͷϧʔτσΟϨΫτϦ
 ʹ഑ஔ   package.json 6OJUZ1BDLBHF.BOBHFSͷ֓ཁ

  44. wηογϣϯ֓ཁ w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w1BDLBHFΛ࢖͏ w1BDLBHFΛ࡞Δ w1BDLBHFΛެ։͢Δ w·ͱΊ   ΞδΣϯμ ΠϚίί

  45. 1BDLBHFΛ࢖͏  

  46. w6OJUZެࣜ1BDLBHF͸6*͔Β w4DPQFE3FHJTUSZͷ1BDLBHF ͸ॳظઃఆ͕ඞཁ   ֓ཁ 1BDLBHFΛ࢖͏

  47.   ॳظઃఆ 1BDLBHFΛ࢖͏ { "scopedRegistries": [ { "name": "Unofficial

    Unity Package Manager Registry", "url": "https://upm-packages.dev", "scopes": [ "dev.monry.upm", "jp.cysharp" ] }, { "name": "KidsStar Unity Package Manager Registry", "url": "https://upm.kidsstar.co.jp", "scopes": [ "jp.co.kidsstar.upm" ] } ], "dependencies": { "com.unity.ads": "2.0.8", // (snip) "com.unity.modules.xr": "1.0.0" } }
  48. wPackages/manifest.jsonΛฤू w"scopedRegistries"ʹఆٛ w"scopes"ʹର৅ͱ͢Δ1BDLBHFͷ 1BDLBHF/BNFΛલํҰகͰ wਂ͞༏ઌϚον   ॳظઃఆ 1BDLBHFΛ࢖͏

  49. { "scopedRegistries": [ { "name": "Unofficial Unity Package Manager Registry",

    "url": "https://upm-packages.dev", "scopes": [ "dev.monry.upm", "jp.co.kidsstar.upm", "jp.cysharp" ] }, { "name": "KidsStar Unity Package Manager Registry", "url": "https://upm.kidsstar.co.jp", "scopes": [ "jp.co.kidsstar.upm.private", "jp.co.kidsstar.project" ] } ], "dependencies": { "com.unity.ads": "2.0.8", // (snip) "com.unity.modules.xr": "1.0.0" } }   4DPQFͷߟ͑ํ 1BDLBHFΛ࢖͏ jp.cysharp.unirx jp.cysharp.unitask jp.co.kidsstar.upm.hoge jp.co.kidsstar.upm.fuga jp.co.kidsstar.upm.private.piyo jp.co.kidsstar.project.ponyo dev.monry.upm.foo " # " " " " " # dev.monry.upm.bar " #
  50. w3FHJTUSZʹ/-/allͱ͍͏
 ΤϯυϙΠϯτ͕͋Ε͹6*ʹҰཡ wͳ͚Ε͹खಈ௥Ճ •"<PackageName>": "<Version>" •Ex) "jp.cysharp.unirx": "7.0.0"  

    1BDLBHFͷ௥Ճ 1BDLBHFΛ࢖͏
  51. w6*্͔Βߋ৽ɾ࡟আՄೳ w6OJUZ1BDLBHF.BOBHFS6*Λ
 ։͍ͨλΠϛϯάͰ3FHJTUSZ΁ͷ
 ໰͍߹Θ͕ͤ૸Δ   1BDLBHFͷߋ৽ɾ࡟আ 1BDLBHFΛ࢖͏

  52. w-5֓ཁ w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w1BDLBHFΛ࢖͏ w1BDLBHFΛ࡞Δ w1BDLBHFΛެ։͢Δ w·ͱΊ   ΞδΣϯμ ΠϚίί

  53. 1BDLBHFΛ࡞Δ  

  54. w௨ৗͷ6OJUZϓϩδΣΫτͷ։ൃͱ
 جຊతʹ͸ಉ͡ w3FHJTUSZʹQVCMJTI͢ΔͨΊͷ
 ز͔ͭͷઃఆɾϑΝΠϧ͕ඞཁʹͳΔ   ֓ཁ 1BDLBHFΛ࡞Δ

  55.   package.json഑ஔ 1BDLBHFΛ࡞Δ { "name": "dev.monry.upm.eventconnector", "displayName": "Event Connector",

    "version": "0.0.1-preview.2", "unity": "2019.1", "description": "Connect presentation events", "author": { "name": "Tetsuya Mori", "url": "https://me.monry.dev/", "email": "monry84@gmail.com" }, "license": "MIT", "keywords": [], "category": "", "dependencies": { "com.stevevermeulen.extenject": "9.0.0", "jp.cysharp.unirx": "7.0.0", "jp.cysharp.unitask": "1.0.0" }, "repository": { "type": "git", "url": "https://github.com/monry/EventConnector" } }
  56.   package.json഑ஔ 1BDLBHFΛ࡞Δ wAssets/௚Լʹ഑ஔ w"name", "version", "unity"
 ͋ͨΓ͕ඞਢ߲໨ wެࣜ1BDLBHFͷpackage.jsonΛࢀߟ

    ʹ͢Δͱྑ͍ w3FWFBMJO'JOEFSͱ͔Ͱ։͚Δ
  57. w1BDLBHFͷϝλ৘ใ΋Assets/௚Լ •README.md •CHANGELOG.md •LICENSE.md wࠓͷॴ.BSLEPXO͡Όͳ͍ͱμϝ   README.mdͳͲ഑ஔ 1BDLBHFΛ࡞Δ

  58. w࢖͍ํͱ͔Λ.BSLEPXOͰॻ͘ •Documentation~/ҎԼ •~෇͖ͷσΟϨΫτϦҎԼ͸
 .meta͕ੜ੒͞Εͳ͍   υΩϡϝϯτ഑ஔ 1BDLBHFΛ࡞Δ

  59. w"TTFNCMZ%FpOJUJPOඞਢ w5FTU"TTFNCMJFT͕ίϯύΠϧ ͞Εͳ͍όά͋Γ w.metaϑΝΠϧ͕ແ͍Ξηοτ͕
 ͋ΔͱΠϯετʔϧ࣌ʹΤϥʔʹͳΔ   ͦͷଞ஫ҙࣄ߲ 1BDLBHFΛ࡞Δ

  60.   ࠷௿ݶͷߏ੒ 1BDLBHFΛ࡞Δ

  61. wηογϣϯ֓ཁ w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w1BDLBHFΛ࢖͏ w1BDLBHFΛ࡞Δ w1BDLBHFΛެ։͢Δ w·ͱΊ   ΞδΣϯμ ΠϚίί

  62. 1BDLBHFΛެ։͢Δ  

  63. w4DPQFE3FHJTUSZ΁ͷೝূΛ௨͢ w$ npm publish Assets   ֓ཁ 1BDLBHFΛެ։͢Δ

  64. w7FSEBDDJPͷ৔߹ϔομʹදࣔ w  w7FSEBDDJPଆͷઃఆʹΑͬͯมΘΔ w$ npm adduser --registry [RegistryURL] w$

    npm login --registry [RegistryURL]   4DPQFE3FHJTUSZ΁ͷೝূ 1BDLBHFΛެ։͢Δ
  65. w~/.npmrcʹ3FHJTUSZ͝ͱͷ
 ೝূ৘ใ͕ॻ͖ࠐ·ΕΔ w1VCMJD1SJWBUFΛ໰Θͣಉ͡   4DPQFE3FHJTUSZ΁ͷೝূ 1BDLBHFΛެ։͢Δ

  66. wѼઌͷ3FHJTUSZΛࢦఆͯ͠ૹ৴ w$ npm publish Assets
 --registry [RegistryURL] w[ProjectRoot]/.npmrcʹ 3FHJTUSZ63-Λॻ͍͓ͯ͘ͱ
 --registry

    ͕ෆཁʹͳΔͷͰศར   npm publish 1BDLBHFΛެ։͢Δ
  67. wηογϣϯ֓ཁ w6OJUZ1BDLBHF.BOBHFSͷ֓ཁ w1BDLBHFΛ࢖͏ w1BDLBHFΛ࡞Δ w1BDLBHFΛެ։͢Δ w·ͱΊ   ΞδΣϯμ ΠϚίί

  68. ·ͱΊ  

  69.   ·ͱΊ ·ͱΊ w6OJUZ1BDLBHF.BOBHFSศར w4DPQFE3FHJTUSZΛ࢖͍͜ͳ͢ͱ ࣗ࡞ɾࣗࣾϥΠϒϥϦͷ؅ཧ΋Մೳ w6/*#00,΋ϤϩγΫʂ

  70.   ੍ݶ ·ͱΊ w4DFOFΛ4DFOFJO#VJMEʹೖΕΒΕͳ͍ w"TTFU#VOEMFԽ͠·͠ΐ͏ w 7FSTJPOͷ4FN7FS3BOHFه๏ෆՄ w ^1.0.0Έ͍ͨͳͷ͕/(

    w 5FTU"TTFNCMJFTෆՄʢόάΒ͍͠ͷͰ͍ͣΕ௚Δ͔΋ʣ w ೝূඞਢͳ3FHJTUSZ΁ͷΞΫηεෆՄʢ޻෉࣍ୈͰ͍͚Δʣ w 6OJUZYͰରԠ͞ΕΔͱ͔ͳΜͱ͔
  71. 0OFNPSFUIJOHʜ  

  72.   1VCMJD3FHJTUSZӡӦதʂ 0OFNPSFUIJOHʜ w6OPGpDJBM6OJUZ1BDLBHF .BOBHFS3FHJTUSZΛӡӦத •https://upm-packages.dev/ wৄࡉ͸https://docs.upm-packages.dev/

  73.   VQNDMJ 0OFNPSFUIJOHʜ w6OJUZ1BDLBHF.BOBHFSͷ
 $PNNBOE-JOF*OUFSGBDF
 ࡞Γ·ͨ͠ • https://github.com/upm-packages/upm-cli/ w$

    upm add package jp.cysharp.unirx
  74.   "QQFOEJY w,JET4UBS5FDI/PUF w https://kidsstar-tbf.booth.pm/ wOQNQBDLBHFKTPO w https://docs.npmjs.com/files/package.json wQBDLBHFKTPOͷಠ֦ࣗு

    w https://docs.unity3d.com/Packages/com.unity.package-manager- ui@2.1/manual/index.html#package-manifests w 7FSEBDDJP • https://verdaccio.org • https://github.com/verdaccio/verdaccio
  75.   "QQFOEJY w6OPGpDJBM6OJUZ1BDLBHF.BOBHFS3FHJTUSZ whttps://upm-packages.dev/ ϨδετϦ  whttps://docs.upm-packages.dev/ %PDVNFOUT 

    • https://github.com/monry/verdaccio-upm/
 4DPQFE3FHJTUSZ༻LTςϯϓϨ • https://github.com/monry/upm-proxy/
 1SJWBUF3FHJTUSZ༻OHJOYϓϩΩγ  • https://monry.hatenablog.com/entry/2019/06/11/161455
 1SJWBUF3FHJTUSZͷݐͯํ wdͰऴΘΔσΟϨΫτϦʹ͍ͭͯ w https://docs.unity3d.com/Manual/SpecialFolders.html
  76. w wʮ7FSEBDDJPʹ/-/allͱ͍͏ΤϯυϙΠϯτ͕ແ͍ʯ
 ͱ͍͏ޡͬͨ৘ใΛ࡟আ wਖ਼͘͠͸ʮWFSEBDDJPHPPHMFDMPVEͱ͍͏ϓϥάΠϯΛ
 ༻͍Δ৔߹ʹͷΈ/-/all͕৘ใΛฦ͞ͳ͘ͳΔʯ wࡉ͔͍ϨΠΞ΢τΛमਖ਼ w$IBOHF-PHΛ௥Ճ w"QQFOEJYΛ௥Ճ  

    $IBOHF-PH
  77. 5IBOLZPVGPSZPVS BUUFOUJPO