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.5k
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
560
Better use of SwiftUI
tattn
0
420
Swift Concurrencyによる安全で快適な非同期処理
tattn
2
1.2k
iOSアプリの技術選択2022
tattn
7
3.8k
Widget Suggestions 対応と ヤフーの新OS対応
tattn
1
1.3k
WidgetKitで良い体験を作るには / Good experience with WidgetKit
tattn
2
1.6k
既存アプリにSwiftUIをどう組み込んでいくか
tattn
8
2.3k
iOS 14からのアプリ内課金
tattn
5
2.8k
iOS 14の位置情報系アップデート
tattn
0
22k
Other Decks in Programming
See All in Programming
家族・子育て重視/沖縄在住を維持しながらエンジニアとしてのキャリアをどのように育てていくか?
ug
0
240
体得しよう!RSA暗号の原理と解読
laysakura
3
530
小さく段階的リリースすることで深夜メンテを回避する
mkmk884
2
130
2025/3/18 サービスの成長で生じる幅広いパフォーマンスの問題を、 AIで手軽に解決する
shirahama_x
0
160
ミリしらMCP勉強会
watany
2
330
AI時代のプログラミング教育 / programming education in ai era
kishida
23
20k
複雑なフォームと複雑な状態管理にどう向き合うか / #newt_techtalk vol. 15
izumin5210
4
3k
php-fpm がリクエスト処理する仕組みを追う / Tracing-How-php-fpm-Handles-Requests
shin1x1
5
820
Django for Data Science (Boston Python Meetup, March 2025)
wsvincent
0
240
Going Structural with Named Tuples
bishabosha
0
170
読もう! Android build ドキュメント
andpad
1
240
本当だってば!俺もTRICK 2022に入賞してたんだってば!
jinroq
0
250
Featured
See All Featured
RailsConf 2023
tenderlove
29
1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
16
1.1k
A Tale of Four Properties
chriscoyier
158
23k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Git: the NoSQL Database
bkeepers
PRO
429
65k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Writing Fast Ruby
sferik
628
61k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
25k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Gamification - CAS2011
davidbonilla
81
5.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
How STYLIGHT went responsive
nonsquared
99
5.4k
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