Slide 1

Slide 1 text

Embedded Unity ాதୡ໵ (@tattn) #potatotips 55

Slide 2

Slide 2 text

ాத ୡ໵ (@tattn) • Yahoo!৐׵Ҋ಺ • iOSΞϓϦΤϯδχΞ @tattn @tanakasan2525 @tattn (झຯͰUnity΍ͬͯ·͢)

Slide 3

Slide 3 text

Unityͱ͸

Slide 4

Slide 4 text

Unityͱ͸ ԿͰ΋ἧͬͯΔήʔϜΤϯδϯ
 2D/3DͷάϥϑΟοΫεΛ؆୯ʹѻ͑Δɻ
 Mac/Win/Linux/iOS/Android/Web/PS4/Switch...
 ͳͲ͍͍ͩͨͷ؀ڥͰಈ͘ɻ

Slide 5

Slide 5 text

Unity੡ΞϓϦͷಛ௃ • ωΠςΟϒͷUIͰ͸ͳ͘ɺ
 ಠࣗͷUIͰ࣮૷͢Δ • ϑϧεΫϦʔϯ

Slide 6

Slide 6 text

Unityͷ࠾༻͕ਏ͍ྫ ωΠςΟϒͷUIͰ͸ͳ͘ɺಠࣗͷUIͰ࣮૷͢Δ ͋Δը໘ΛUnityͰඳը͍͕ͨ͠ɺ
 ͦΕҎ֎͸ωΠςΟϒͷUI͕ྑ͍৔߹͸େม
 (͍ۙUIΛࣗલͰ࣮૷͢Δඞཁ͕͋Δ)

Slide 7

Slide 7 text

Embedded Unity

Slide 8

Slide 8 text

UnityΛωΠςΟϒΞϓϦʹຒΊࠐΉ

Slide 9

Slide 9 text

DEMO

Slide 10

Slide 10 text

DEMOࣦഊ༻ / PDF༻ ←ωΠςΟϒͷ
 NavigationBar ωΠςΟϒͷ
 ˡTabBar ←ωΠςΟϒͷ
 Switch ←Unityͷը໘͕
 ϑϧεΫϦʔϯ
 Ͱ͸ͳ͍

Slide 11

Slide 11 text

UnityͷωΠςΟϒϏϧυͷ ͘͠Έ

Slide 12

Slide 12 text

UnityͷiOSϏϧυ 1. C#ͷίʔυΛC#ίϯύΠϥͰϚωʔδυΞηϯϒϦԽ 2. ࠷దԽ (࢖͍ͬͯͳ͍ඪ४Ϋϥεͷίʔυ࡟আͳͲ) 3. IL2CPPͰC++ͷίʔυʹม׵ 4. ClangͰiOS༻ͷόΠφϦ΁Ϗϧυ IUUQTEPDTVOJUZEDPN%PDVNFOUBUJPO.BOVBM*-$11)PX*U8PSLTIUNM

Slide 13

Slide 13 text

Unityͷը໘ (iOS) ࣗಈੜ੒͞ΕͨAppDelegateͰ
 ViewController΍ViewΛ૊Έཱͯͯ
 ϑϧεΫϦʔϯͷը໘Λද͍ࣔͯ͠Δ

Slide 14

Slide 14 text

UnityͷViewΛҾͬுͬͯ͘Ε͹
 ޷͖ͳͱ͜ΖʹUnityͷը໘Λஔ͚Δ

Slide 15

Slide 15 text

UnityΛEmbedded FrameworkԽ͢Δ ※Unity 2018.2.11f1ɺXcode 10.0Λ࢖༻

Slide 16

Slide 16 text

Cocoa Touch FrameworkΛͭ͘Δ ੜ੒͞ΕͨϓϩδΣΫτΛ։͖ɺ
 frameworkΛλʔήοτʹ௥Ճɻ Unity-iPhoneʹ͋Δ.mm΍.hϑΝΠϧΛ
 ΄΅ίϐʔ͢Δ

Slide 17

Slide 17 text

࢖༻͢ΔHeaderΛPublicʹ͢Δ framework֎͔Β࢖༻͢ΔHeaderΛPublicʹ͢Δ

Slide 18

Slide 18 text

ϓϩδΣΫτઃఆΛॻ͖׵͑Δ .xcconfigϑΝΠϧΛ࡞ͬͯɺઃఆ͢Δͱָ (Ұ෦ൈਮ) IUUQTHJTUHJUIVCDPNUBUUOEBDDCDEGGFD

Slide 19

Slide 19 text

ίʔυΛগ͠ॻ͖׵͑Δ ύεΛมߋͨ͠Γɺextern "C"ͳͲΛ௥Ճ͢Δ ͕࣌ؒͳ͍ͷͰলུ

Slide 20

Slide 20 text

ωΠςΟϒΞϓϦʹ૊ΈࠐΉ ࣗಈੜ੒͞Εͨmain.mmΛࢀߟʹ͢Δ

Slide 21

Slide 21 text

UnityͷViewΛऔಘͯ͠දࣔ

Slide 22

Slide 22 text

iOSͱUnityؒͷ΍ΓऔΓ (ωΠςΟϒ)
 UnitySendMessageͰ
 UnityʹσʔλΛૹΔ (Unity)
 ಉ໊ͷϝιουͰ
 σʔλΛड͚औΔ (σϞ༻ͷ࣮૷ͷͨΊϩδοΫ͸ద౰Ͱ͢...)

Slide 23

Slide 23 text

͢Δͱɺ͜͏ͳΓ·͢

Slide 24

Slide 24 text

Unityͷগ͠લͷϦϦʔεϊʔτ IUUQTVOJUZEDPNKQVOJUZXIBUTOFXVOJUZ (1068657) - IL2CPP: Prevented a crash in il2cpp::os::Image::Initialize when Unity is embedded in another app on iOS. →iOSͰଞͷΞϓϦʹUnityΛຒΊࠐΜͩ࣌ͷΫϥογϡΛ๷͙ Unityଆ΋EmbeddedΛαϙʔτ͢Δҙࢥ͕͋Δ

Slide 25

Slide 25 text

·ͱΊ

Slide 26

Slide 26 text

ωΠςΟϒΞϓϦʹUnityΛ૊ΈࠐΊΔ • গ͠मਖ਼͸͍Δ͕Framework / AARԽͰ͖Δ • UnityͷPostProcessBuildΛ࢖͏ͱमਖ਼࡞ۀΛ
 ׬શʹࣗಈԽͰ͖Δ • Unityͷ๛෋ͳࢿ࢈Λ࢖͑Δ ʘSceneKitɾOpenGL͕ਏ͍৔߹͸͋Γ͔΋ʗ

Slide 27

Slide 27 text

ࢀߟจݙ • https://github.com/jiulongw/swift-unity • https://github.com/blitzagency/ios-unity5 • https://github.com/samizzo/UnityNativePrototype • https://forum.unity.com/threads/build-unity-app-as-framework-then-consumed- by-another-app.430068/ • https://issuetracker.unity3d.com/issues/il2cpp-ios-crash-in-il2cpp-os-image- initialize-inlined-il2cpp-os-image-initializemanagedsection-at-image-dot-cpp-81