https://github.com/snowballdigital/flutter-unity-view-widget
example/unity/DemoApp/
サンプルとして入ってるDemoAppは "2019.3.0b7 beta" のバージョン
現在は「2019.3.0b9 beta」があるが、
https://unity3d.com/unity/beta/2019.3
DemoApp変換するとおかしくなる。
- 変換する Unityのメニューから
Flutter => Export IOS を選択する。
- 設定する
ios/UnityExport
example/ios/Runner.xcworkspace
typoあった
GeneratePluginRegistrant
=> GeneratedPluginRegistrant
→ プルリクしたら取り込まれた。 https://github.com/snowballdigital/flutter-unity-view-widget/pull/75
Info.plist
ファイルの io.flutter.embedded_views_preview
を YES
にする。
→ 元々なってた
Could not find 'CFPropertyList' (>= 2.3.3, < 4.0) among 72 total gem(s) (Gem::MissingSpecError)
https://rubygems.org/gems/CFPropertyList/versions/3.0.0?locale=ja
sudo gem install CFPropertyList -v 3.0.0
で入れた。
- ビルド時
You must set a build name and number in the pubspec.yaml
name: flutter_unity_widget_example description: Demonstrates how to use the flutter_unity_widget plugin. version: 1.0.0+1 publish_to: 'none'
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 13.2
Dataフォルダの件はここ
swiftのファイルをいじるらしいが、ここにある。
「iOS Platform Only」にある!これに気をつける!!!
Xcodeでは「Runner」を選択し「Add Files to “Runner”」を選択する。
open your ios/Runner.xcworkspace (workspace!, not the project) in Xcode and add the exported project in the workspace root (with a right click in the Navigator, not on an item -> Add Files to “Runner” -> add the UnityExport/Unity-Iphone.xcodeproj file
こいつはここで追加か?
こうなったがいいのか?
「Runnner」の「General」のFrameworksの「UnityFramework.framework」の黄色がなぜか薄い・・・。
いったん「UnityFramework.framework」を -
してもう一度「UnityFramework.framework」を選んで +
で色がちゃんとした黄色のが選ばれる。
なぜかSimulatorは動かない・・・ 以下のエラーが出る。
contain platform 'iphonesimulator' in its supported platforms 'iphoneos'
実機だとうまく行った。
- Dart側 (Flutter)
void setRotationSpeed(String speed) { _unityWidgetController.postMessage( 'Cube', 'SetRotationSpeed', speed, ); }
- C# (Unity)
// This method is called from Flutter public void SetRotationSpeed(String message) { float value = float.Parse(message); RotateAmount = new Vector3(value, value, value); }