万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    flutter-unity-view-widget を試す

    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_previewYES にする。 → 元々なってた

    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フォルダの件はここ f:id:shinriyo:20191104165715p:plain

    swiftのファイルをいじるらしいが、ここにある。 f:id:shinriyo:20191104165652p:plain

    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

    こいつはここで追加か? f:id:shinriyo:20191104165739p:plain

    こうなったがいいのか? f:id:shinriyo:20191104165834p:plain

    「Runnner」の「General」のFrameworksの「UnityFramework.framework」の黄色がなぜか薄い・・・。 f:id:shinriyo:20191104165619p:plain

    いったん「UnityFramework.framework」を - してもう一度「UnityFramework.framework」を選んで + で色がちゃんとした黄色のが選ばれる。 f:id:shinriyo:20191104165807p:plain

    なぜかSimulatorは動かない・・・ 以下のエラーが出る。

        contain platform 'iphonesimulator' in its supported platforms 'iphoneos'

    実機だとうまく行った。

      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);
        }