arcore_flutter_plugin |
flutter_unity_widget |
|---|---|
- arcore_flutter_plugin | Flutter package
- 非公式パッケージで対応はAndroidのみ
- iOSサポートはイシュー化されているものの当面対応は期待できなさそう
- 2024.07時点Kotlinバージョン周りの問題で最新masterでしかビルドが成功しない点に注意
- Issueもたくさん残っており最近はあまり改善なさそう
ArNodeのHot Reloadも効かないので開発しづらい- Hot Restartを試みるとExitedとなりアプリケーションが終了してしまう問題
- arcore_flutter_pluginを使ったGeometric Shapesを配置するサンプル動画(Youtube)
- ar_flutter_plugin | Flutter package
- arkit_plugin | Flutter package とarcore_flutter_plugin | Flutter packageを組み合わせて、iOS・Android両対応できるようにしたもの
- ARCore自体iOSも対応しているが、専用のパッケージがないのでARKitと併用しているということだろう
- FlutterでARアプリを開発する場合は、ARKitとARCoreの合せ技が主流?
- 前述の
ar_flutter_plugin使えば比較的簡単に実現できそう -
FlutterにARKitとARCoreを組み合わせれば、Android向けとiOS向けのARアプリを同じコードベースで開発できるのではないか
- [Flutter開発]FlutterとARCoreを組み合わせてAndroidのARアプリを作成してみる #Dart - Qiita
- 前述の
- Redditでのディスカッション
- Unity as a LibraryでFlutterに組み込む
- Unity as a LibraryはUnityプロジェクトをiOS・Android・WebGLなどにエクスポートできる機能
- iOS・Androidにエクスポートし、MethodChannelでFlutterから呼び出す方法
- juicycleff/flutter-unity-view-widgetが有名みたい(flutter_unity_widget | Flutter package)
- Flutter Engineの上でUnityの3Dオブジェクトを表示しインタラクティブ操作も可能
postMessageメソッドが肝でMethodChannel使っている-
UnityPlayer.UnitySendMessageでUnity関数をコール
- 活用事例
- 他にも調べてみたら最近のパッケージでflutter_embed_unity | Flutter packageも良さそう
- FlutterをAdd-to-appでUnityに組み込む
- Geospatial API自体はFlutterの公式パッケージが存在しない模様
- 公式サイトに記載がなく、pub.devで探してみても野良のパッケージすら存在しない
- Build global-scale, immersive, location-based AR experiences with the ARCore Geospatial API | Google for Developers
ar_flutter_pluginはsceneview_flutter | Flutter packageでGeospatial APIに対応しているコメントあり(ただしこちらもサポートはAndroidのみ)- SceneViewの正体を探るところからだが、SceneFormというのが古い実装でSceneViewが新しい実装という位置づけぽい
- ref. giandifra/arcore_flutter_plugin#203 (comment)
- しかもまだSkelton状態とのこと
- What went wrong: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. The following dependencies do not satisfy the required version: project ':arcore_flutter_plugin' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
- Google CloudでのARCore APIの有効化
- CocoapodsまたはSwift Package ManagerでARCoreライブラリのインストール
- Geospatial APIを使用する場合は、
pod 'ARCore/Geospatial'と指定
- Geospatial APIを使用する場合は、
- Enable AR in your iOS app | ARCore | Google for Developers
[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod
FirebaseCoreInternal-librarydepends uponGoogleUtilities-library, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may setuse_modular_headers!globally in your Podfile, or specify:modular_headers => truefor particular dependencies.
The Swift pod
FirebaseRemoteConfig-librarydepends uponFirebaseABTesting-library,FirebaseCore-library,FirebaseInstallations-library, andGoogleUtilities-library, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may setuse_modular_headers!globally in your Podfile, or specify:modular_headers => truefor particular dependencies.
targetに記載されていたuse_modular_headers!をグローバルに配置して解消
target 'Runner' do
use_frameworks!
# use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
↓
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
pod 'ARCore/Geospatial'
use_modular_headers!