Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Embedded Unity
Search
Tatsuya Tanaka
October 09, 2018
Programming
4
1.4k
Embedded Unity
#potatotips 55
Tatsuya Tanaka
October 09, 2018
Tweet
Share
More Decks by Tatsuya Tanaka
See All by Tatsuya Tanaka
iPhoneのセンサー情報をmacOSアプリでリアルタイム活用するための技術
tattn
1
510
Better use of SwiftUI
tattn
0
380
Swift Concurrencyによる安全で快適な非同期処理
tattn
2
1.1k
iOSアプリの技術選択2022
tattn
7
3.7k
Widget Suggestions 対応と ヤフーの新OS対応
tattn
1
1.2k
WidgetKitで良い体験を作るには / Good experience with WidgetKit
tattn
2
1.5k
既存アプリにSwiftUIをどう組み込んでいくか
tattn
8
2.3k
iOS 14からのアプリ内課金
tattn
5
2.7k
iOS 14の位置情報系アップデート
tattn
0
22k
Other Decks in Programming
See All in Programming
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
100
Arm移行タイムアタック
qnighy
0
320
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
Jakarta EE meets AI
ivargrimstad
0
140
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
Quine, Polyglot, 良いコード
qnighy
4
640
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Building Your Own Lightsaber
phodgson
103
6.1k
Designing for humans not robots
tammielis
250
25k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
4 Signs Your Business is Dying
shpigford
180
21k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
How STYLIGHT went responsive
nonsquared
95
5.2k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Transcript
Embedded Unity ాதୡ (@tattn) #potatotips 55
ాத ୡ (@tattn) • Yahoo!Ҋ • iOSΞϓϦΤϯδχΞ @tattn @tanakasan2525 @tattn
(झຯͰUnityͬͯ·͢)
Unityͱ
Unityͱ ԿͰἧͬͯΔήʔϜΤϯδϯ 2D/3DͷάϥϑΟοΫεΛ؆୯ʹѻ͑Δɻ Mac/Win/Linux/iOS/Android/Web/PS4/Switch... ͳͲ͍͍ͩͨͷڥͰಈ͘ɻ
UnityΞϓϦͷಛ • ωΠςΟϒͷUIͰͳ͘ɺ ಠࣗͷUIͰ࣮͢Δ • ϑϧεΫϦʔϯ
Unityͷ࠾༻͕ਏ͍ྫ ωΠςΟϒͷUIͰͳ͘ɺಠࣗͷUIͰ࣮͢Δ ͋Δը໘ΛUnityͰඳը͍͕ͨ͠ɺ ͦΕҎ֎ωΠςΟϒͷUI͕ྑ͍߹େม (͍ۙUIΛࣗલͰ࣮͢Δඞཁ͕͋Δ)
Embedded Unity
UnityΛωΠςΟϒΞϓϦʹຒΊࠐΉ
DEMO
DEMOࣦഊ༻ / PDF༻ ←ωΠςΟϒͷ NavigationBar ωΠςΟϒͷ ˡTabBar ←ωΠςΟϒͷ Switch ←Unityͷը໘͕
ϑϧεΫϦʔϯ Ͱͳ͍
UnityͷωΠςΟϒϏϧυͷ ͘͠Έ
UnityͷiOSϏϧυ 1. C#ͷίʔυΛC#ίϯύΠϥͰϚωʔδυΞηϯϒϦԽ 2. ࠷దԽ (͍ͬͯͳ͍ඪ४ΫϥεͷίʔυআͳͲ) 3. IL2CPPͰC++ͷίʔυʹม 4. ClangͰiOS༻ͷόΠφϦϏϧυ
IUUQTEPDTVOJUZEDPN%PDVNFOUBUJPO.BOVBM*-$11)PX*U8PSLTIUNM
Unityͷը໘ (iOS) ࣗಈੜ͞ΕͨAppDelegateͰ ViewControllerViewΛΈཱͯͯ ϑϧεΫϦʔϯͷը໘Λද͍ࣔͯ͠Δ
UnityͷViewΛҾͬுͬͯ͘Ε ͖ͳͱ͜ΖʹUnityͷը໘Λஔ͚Δ
UnityΛEmbedded FrameworkԽ͢Δ ※Unity 2018.2.11f1ɺXcode 10.0Λ༻
Cocoa Touch FrameworkΛͭ͘Δ ੜ͞ΕͨϓϩδΣΫτΛ։͖ɺ frameworkΛλʔήοτʹՃɻ Unity-iPhoneʹ͋Δ.mm.hϑΝΠϧΛ ΄΅ίϐʔ͢Δ
༻͢ΔHeaderΛPublicʹ͢Δ framework֎͔Β༻͢ΔHeaderΛPublicʹ͢Δ
ϓϩδΣΫτઃఆΛॻ͖͑Δ .xcconfigϑΝΠϧΛ࡞ͬͯɺઃఆ͢Δͱָ (Ұ෦ൈਮ) IUUQTHJTUHJUIVCDPNUBUUOEBDDCDEGGFD
ίʔυΛগ͠ॻ͖͑Δ ύεΛมߋͨ͠Γɺextern "C"ͳͲΛՃ͢Δ ͕࣌ؒͳ͍ͷͰলུ
ωΠςΟϒΞϓϦʹΈࠐΉ ࣗಈੜ͞Εͨmain.mmΛࢀߟʹ͢Δ
UnityͷViewΛऔಘͯ͠දࣔ
iOSͱUnityؒͷΓऔΓ (ωΠςΟϒ) UnitySendMessageͰ UnityʹσʔλΛૹΔ (Unity) ಉ໊ͷϝιουͰ σʔλΛड͚औΔ (σϞ༻ͷ࣮ͷͨΊϩδοΫదͰ͢...)
͢Δͱɺ͜͏ͳΓ·͢
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Λαϙʔτ͢Δҙࢥ͕͋Δ
·ͱΊ
ωΠςΟϒΞϓϦʹUnityΛΈࠐΊΔ • গ͠मਖ਼͍Δ͕Framework / AARԽͰ͖Δ • UnityͷPostProcessBuildΛ͏ͱमਖ਼࡞ۀΛ શʹࣗಈԽͰ͖Δ • Unityͷ๛ͳࢿ࢈Λ͑Δ
ʘSceneKitɾOpenGL͕ਏ͍߹͋Γ͔ʗ
ࢀߟจݙ • 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