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

Unity meets Clean Architecture

Tetsuya Mori
December 09, 2017

Unity meets Clean Architecture

【年末だよ】Unity お・と・な のLT大会 2017【ポロりしてもいいのよ】での発表資料です。

Tetsuya Mori

December 09, 2017
Tweet

More Decks by Tetsuya Mori

Other Decks in Programming

Transcript

  1. 6OJUZNFFUT
    $MFBO"SDIJUFDUVSF
    6OJUZ͓ɾͱɾͳͷ-5େձ
    גࣜձࣾΩοζελʔ
    $505FDI-FBEɹ৿ɹ఩࠸

    View full-size slide

  2. 8IPBNɹ
    w /JDLOBNFNPOSZ
    w /BNF৿ɹ఩࠸
    w 8PSL,JET4UBS*OD
    w 5XJUUFS!NPOSZ
    w 'BDFCPPLNPOSZ
    w (JU)VCNPOSZ
    w +PC6OJUZશൠɺϏϧυ͓͡͞Μ

    View full-size slide

  3. ಥવͰ͕͢

    View full-size slide

  4. 6OJUZ։ൃ͋Δ͋Δ

    View full-size slide

  5. 6OJUZ։ൃ͋Δ͋Δ
    w ʮ͜ͷॲཧɺͲ͜ʹॻ͚͹ྑ͍ͷʜʁʯ
    w αϯϓϧίʔυ͸ωοτʹ͍ͬͺ͍͋Δ͚Ͳɺ

    ॻ͖ํ͕όϥόϥ
    w ͳΜͳΒ6OJUZެࣜͷϚχϡΞϧͱ͔΋Ұ؏ੑ͕ແ͍

    View full-size slide

  6. 6OJUZ։ൃ͋Δ͋Δ
    w ʮ͜͜ʹ࢓༷௥Ճ͍ͨ͠Μ͚ͩͲʜɻʯ
    w ӨڹൣғɺΊͬͪΌ޿͍ʜɻ
    w ίονΛ௚͢ͱΞονʹӨڹͪ͠Όͬͯʜɻ
    w Θʔ͍ɺ

    View full-size slide

  7. 6OJUZ։ൃ͋Δ͋Δ
    w ʮίʔυϨϏϡʔśūŢŒţʯ
    w ϨϏϡϫʔʮԿॲʹԿ͕ॻ͔ΕͯΔ͔෼͔ΒΜʜɻʯ
    w ϨϏϡΠʔʮΫϥεͷ੹೚ൣғͱ͔ݴΘΕͯ΋ʜɻʯ

    View full-size slide

  8. ͦΕ͸ภʹ
    ͻͱ͑

    View full-size slide

  9. ઃܭෆ଍ʂ

    View full-size slide

  10. ઃܭͷॏཁੑ͸
    UP3JTPV1͞ΜͷొஃࢿྉΛ
    ಡ΋͏ʂ

    View full-size slide

  11. ࠓ೔͸ɺͦΜͳʮઃܭͷॏཁੑ͕

    ཧղग़དྷͨʯوํʹૹΔ಺༰Ͱ͢

    View full-size slide

  12. Ҏ্ɺ௕͍લஔ͖ɻ

    View full-size slide

  13. ʢΦϨ͕ࢥ͏ʣ

    6OJUZͷֶशϓϩηε

    View full-size slide

  14. 6OJUZֶशϓϩηε
    w 77JFX
    w 7JFX.POP#FIBWJPVSͷ

    4UBSU
    ΍Β6QEBUF
    ΍ΒʹΰϦοΰϦʹॻ͘
    w 7JFXͱ7JFXͱͷ݁߹͕ڧ͘ͳΓ͕ͪ
    w ʮந৅ԽʁͳʹͦΕ͓͍͍͠ͷʁʯঢ়ଶͳͷͰ

    %3:ݪଇͱ͔ɺͲ͜ਧ͘෩ঢ়ଶ
    w ஋อ࣋༻ͷ4JOHMFUPO.POP#FIBWJPVS͘Μొ৔

    View full-size slide

  15. 6OJUZֶशϓϩηε
    w 7$7JFX$POUSPMMFS
    w 7JFX͚ͩͩͱγϯυ͘ͳ͖ͬͯͯɺ

    .BOBHFS͕ྔ࢈͞ΕΔ
    w (BNF.BOBHFSͱ͔͍͏ڊେͳΫϥε͕ग़དྷ্͕Δ
    w $POUSPMMFSͱ7JFXͱͷ݁߹ڧ౓͕ڧ͍
    w ςετͱ͔ॻ͚ͨ΋Μ͡Όͳ͍

    View full-size slide

  16. 6OJUZֶशϓϩηε
    w .7$.PEFM7JFX$POUSPMMFS
    w .PEFMͱͯ͠஋Λ࣋ͭΫϥε͕ొ৔͢Δ
    w ͜ͷล͔ΒΑ͋͘ΔϓϩδΣΫτʹͳΔ
    w 7JFXͱ.PEFM͕૬ޓʹࢀরΛ࣋ͪෳࡶԽ͢Δ
    w 7JFX΍.PEFMͷมߋʹऑ͍ʢ࢓༷มߋʹऑ͍ʣ

    View full-size slide

  17. 6OJUZֶशϓϩηε
    w .77. 1
    .PEFM7JFX7JFX.PEFM 1SFTFOUFS

    w 6OJ3YʢͳͲʣΛ࢖͍ɺ.7$ͷ֤ϨΠϠΛ෼཭
    w ϨΠϠؒͰͷґଘΛݮΒ͢
    w ΄΅͜Ε͕౴͑ͳײ͡͸͢Δʂ
    w Ͱ΋ɺϧʔϧ͕ᐆດͰϨʔϧ͕ෑ͔Ε͍ͯͳ͍ײ͡

    View full-size slide

  18. ͯ͜ͱͰɺ·ͩ՝୊͕͋Δ

    View full-size slide

  19. $MFBO"SDIJUFDUVSF

    View full-size slide

  20. $MFBO"SDIJUFDUVSF
    w JTԿʁ
    w ݩʑ͸೥ʹ6ODMF#PCʹΑΓఏএ͞Εͨ

    ΞʔΩςΫνϟ
    w J04ք۾ͰΑ͘࢖ΘΕ͍ͯΔͱ͔͍ͳ͍ͱ͔

    View full-size slide

  21. $MFBO"SDIJUFDUVSF
    w ͜Μͳਤͱ͔
    ग़య5IF$MFBO"SDIJUFDUVSF

    View full-size slide

  22. $MFBO"SDIJUFDUVSF
    w ͜Μͳਤͱ͔
    ग़య·ͩ.7$ .71 .77.Ͱফ໣ͯ͠ΔͷʁJ04$MFBO"SDIJUFDUVSFʹ͍ͭͯ

    View full-size slide

  23. $MFBO"SDIJUFDUVSF
    w Ͱද͞ΕΔ֓೦
    w ͋͘·ͰʮΞʔΩςΫνϟʯͰ͋Γ

    ʮϑϨʔϜϫʔΫʯͰ͸ͳ͍
    w ΦϒδΣΫτࢦ޲ϓϩάϥϛϯάʹԙ͚Δ

    ʮීวతͳߟ͑ํʯʹͳΔͷͰɺݴޠΛ໰Θͣ࢖͑Δ

    View full-size slide

  24. $MFBO"SDIJUFDUVSF
    w ϝϦοτ
    w άάΕ
    w εΫϦϓςΟϯάͷํ޲ੑͱͯ͠ҰͭͷಓےͱͳΔ
    w 1MBZ.PEF&EJU.PEF໰Θͣɺςετ͕ॻ͖΍͍͢
    w େن໛ϓϩμΫτ΍த௕ظతʹϝϯςφϯε͢Δϓϩ
    μΫτʹ࠷ద

    View full-size slide

  25. $MFBO"SDIJUFDUVSF
    w σϝϦοτ
    w άάΕ
    w ίʔυͷϑΝΠϧ਺͕ΊͬͪΌ૿͑Δ
    w ֶशίετ͕ͪΐͬͱߴ͍
    w ϓϩτλΠϓ΍খن໛ϓϩμΫτʹ͸޲͔ͳ͍

    View full-size slide

  26. 6OJUZͰ΍ͬͯΈͨ

    View full-size slide

  27. 6OJUZͰ΍ͬͯΈͨ
    w 1SFTFOUBUJPO-BZFS
    w 7JFX
    w ͦͷ··.POP#FIBWJPVS
    w ࣗ਎ͷඳըͱࢠཁૉͷੜ੒Λ࢘Δ
    w ΠϕϯτϋϯυϦϯά΋ίΠπͷ࢓ࣄ
    w 7JFX$POUSPMMFSతͳΫϥεΛ༻ҙ͢ΔͱϤαι΢

    View full-size slide

  28. 6OJUZͰ΍ͬͯΈͨ
    w 1SFTFOUBUJPO-BZFS
    w 1SFTFOUFS
    w 7JFXͱ6TF$BTFΛܨ͙
    w 6OJ3Yଟ༻͢Δ
    w ίίʹϩδοΫ͸ॻ͔ͳ͍

    View full-size slide

  29. 6OJUZͰ΍ͬͯΈͨ
    w %PNBJO-BZFS
    w 6TF$BTF
    w ϏδωεϩδοΫ
    w 7JFXʹ΋%BUBʹ΋ґଘ͠ͳ͍Α͏ʹॻ͘
    w ʮυϝΠϯʯʹରͯ͠Ϋϥε࡞Δ

    View full-size slide

  30. 6OJUZͰ΍ͬͯΈͨ
    w %PNBJO-BZFS
    w .PEFM
    w ʮදࣔ༻ͷ஋ʯΛ؅ཧ͢Δ
    w දࣔ࣌ͷ࠲ඪͱ͔ͷఆ਺Λ࣋ͬͯ΋Ϥαι΢

    View full-size slide

  31. 6OJUZͰ΍ͬͯΈͨ
    w %PNBJO-BZFS
    w 5SBOTMBUPS
    w &OUJUZʢޙड़ʣͱ.PEFMΛ૬ޓʹม׵͢Δ
    w ಉظɾඇಉظΛߟྀ͢ΔͱϤαι΢

    View full-size slide

  32. 6OJUZͰ΍ͬͯΈͨ
    w %PNBJO-BZFS
    w 3FQPTJUPSZ
    w %BUB4UPSFʢޙड़ʣͱ6TF$BTFͱͷ૭ޱ
    w 6TF$BTF͸ίΠπͱର࿩ͯ͠σʔλΛ΍ΓͱΓ͢Δ
    w ݫີʹ͸%PNBJO-BZFSͰ͸ͳ͘

    %PNBJOͱ%BUBͷதؒʹҐஔ͢Δ֓೦

    View full-size slide

  33. 6OJUZͰ΍ͬͯΈͨ
    w %BUB-BZFS
    w &OUJUZ
    w ʮ֎෦ͷ஋ʯΛ؅ཧ͢Δ
    w 8FC"1*ͱ͔4DSJQUBCMF0CKFDUͱ͔

    1MBZFS1SFGTͱ͔ͷιʔείʔυͷ֎ͷ஋Λදݱ
    w σʔλͷग़ࣗΛ໰ΘͣΫϥε͸σʔλʹ͖ͭͭ

    View full-size slide

  34. 6OJUZͰ΍ͬͯΈͨ
    w %BUB-BZFS
    w %BUB4UPSF
    w &OUJUZͷೖग़ྗΛऔΓѻ͏
    w &OUJUZͷσʔλͷग़ࣗʹΑͬͯಡΈॻ͖ͷ

    ॲཧΛ࣮૷͢Δ
    w ಡΈॻ͖ͷ࣮ॲཧ͸ڞ௨ԽͰ͖Δ͕ɺ

    ΠϯλϑΣʔε͸ݸผʹ࣮૷͢Δίτ͕๬·͍͠

    View full-size slide

  35. ͳΜͷͬͪ͜ΌͰ͢Ͷɻ

    View full-size slide

  36. ͬͯ͜ͱͰɺॻ͖·ͨ͠

    View full-size slide

  37. $"'6
    $MFBO"SDIJUFDUVSFGPS6OJUZ

    View full-size slide

  38. IUUQTHJUIVCDPNVNNQSPKFDUTDBGV@DPSF

    View full-size slide

  39. $"'6
    w Α͋͘ΔʮΦϨΦϨϑϨʔϜϫʔΫʯͰ͸ͳ͘ɺ͋͘·Ͱ
    ʮΞʔΩςΫνϟʯͱͯ͠ͷ࣮૷
    w ຆͲϝιου͸ੜ͓͑ͯΒͣɺز͔ͭͷJOUFSGBDFͰߏ੒
    w 6OJUZͱͷ݁߹͕ڧ͘ͳΔՕॴʹ͸جఈΫϥεͱ͔Λ࣮૷
    w .POP#FIBWJPVSͱ͔4DSJQUBCMF0CKFDUͱ͔

    View full-size slide

  40. $"'6
    w .PEFM΍6TF$BTFͷઃܭΛͤͣʹॻ͖࢝ΊΔͱ

    ௧͍໨ΛݟΔͷͰɺΫϥεਤΛॻ͘͜ͱΛΦεεϝ͠·͢
    w ·ͩ·ͩ։ൃதͳͷͰɺ౰໘҆ఆ͠ͳ͍͔΋ʜ
    w Ωοζελʔͷ։ൃݱ৔Ͱ࣮ࡍʹࢼݧಋೖத
    w ϝδϟʔόʔδϣϯΛʹԼ͛Α͏͔ࢥҊத
    w ը໘ભҠʹؔ͢Δॲཧ͸ڞ௨Խͯ͠ผϦϙδτϦͰ؅ཧ

    View full-size slide

  41. ڵຯ͋Δਓ͸ੋඇ

    1VMM3FRVFTU౤͍͛ͯͩ͘͞

    View full-size slide

  42. ॴײ
    w Ϋϥεઃܭ΍ίʔσΟϯάͷ࣌ͷʮ໎͍ʯ͕ͳ͘ͳΔ
    w ׳Εͯ͘Ε͹ɻ
    w ΍ͬͺΓֶशίετ͕ͦΕͳΓʹߴ͍
    w ΄ͲΑ͍റΓ͕͋Δ͓ӄͰϨʔϧʹͳͬͯ͘Ε͍ͯΔ
    w ઃܭϨϏϡʔ΍ίʔυϨϏϡʔ͠΍͍͢
    w 1MBZ.PEF&EJU.PEF໰Θͣςετίʔυॻ͖΍͍͢

    View full-size slide

  43. ॴײ
    w ෳ਺ਓͰҰͭͷϓϩμΫτΛ։ൃ͢Δࡍʹɺ଍ฒΈΛἧ͑
    ΒΕΔͱ͍͏େ͖ͳϝϦοτΛڗडͰ͖͍ͯΔ
    w ͱ͸͍͑ɺΤϯδχΞʹରͯ͠ٻΊΒΕΔϋʔυϧ্͕͕
    Δͷ΋·ͨࣄ࣮
    w 6OJUZͦͷ΋ͷͷ"1*ʹറΒΕͳ͍ͷͰɺͭͿ͕͠ޮ͘

    View full-size slide

  44. ༻๏༻ྔΛकͬͯ

    ਖ਼͘͠͝ར༻͍ͩ͘͞

    View full-size slide

  45. ΋ΜΓ͌ઌੜ
    w 4DIPPͰ6OJUZͷतۀΛ࣋ͭίτʹͳΓ·ͨ͠ʂ
    w IUUQTTDIPPKQDMBTT
    w 5VF
    d
    w ੜ์ૹ͸ແྉͳͷͰɺੋඇͱ΋͝ཡ͍ͩ͘͞·ͤʂ

    View full-size slide

  46. 1BUDI3FMFBTF/PUFT຋༁
    w 1BUDI3FMFBTFͷ3FMFBTF/PUFTΛ຋༁͢Δ

    ݸਓϓϩδΣΫτ΍ͬͯ·͢ɻ
    w IUUQVOJUZSFMFBTFOPUFTIBUFOBCMPHDPN
    w γΣΞͱ͔ελʔͱ͔෇͚ͯ͘ΕΔͱɺ΋ΜΓ͌ͷ

    Ϟνϕʔγϣϯ͕͕͋Γ·͆͢

    View full-size slide

  47. 8FBSFIJSJOH
    גࣜձࣾΩοζελʔͰ͸
    ʮࢠͲ΋ͷເதΛҭͯΔʯ
    ϓϩμΫτͷ։ൃΛࢧ͑Δ
    σϕϩούʔΛืूதͰ͢ʂ

    View full-size slide

  48. 5IBOLZPVGPS
    ZPVSBUUFOUJPO

    View full-size slide