- Flutter latest stable version
- Unity 2019.4.27f1 LTS
- flutter_unity_widget 4.2.0
- Unity: Auto build and config iOS
- Unity: Auto build and config Android
- Fastlane: iOS
- Fastlane: Android
- Game CI: Export unity iOS
- Game CI: Export unity Android
- Fastlane: iOS
- Fastlane: Android
├─ ios
├─ android
├─ lib
├─ main.dart
├─ unity
├─ unity-project
├─ Assets
├─ pubspec.yaml
Create make file and prepare commend line that use unity to excuse C# function.
unity_app = /Applications/Unity/Hub/Editor/2019.4.27f1/Unity.app/Contents/MacOS/Unity
project_path = unity/unity_project/
# all: unity_ios unity_android
unity_ios:
${unity_app} -quit -bachmode -projectPath ${project_path} -executeMethod Build.DoBuildIOS
unity_android:
${unity_app} -quit -bachmode -projectPath ${project_path} -executeMethod Build.DoBuildAndroid
The result after export succeeded
├─ ios
├─ UnityLibrary
├─ android
├─ unityLibrary
├─ lib
├─ main.dart
├─ unity
├─ unity-project
├─ Assets
├─ pubspec.yaml
- Setup fastlane separately for ios and android. After that we got
├─ ios
├─ UnityLibrary
├─ fastlane
├─ Gemfile
├─ android
├─ unityLibrary
├─ fastlane
├─ Gemfile
├─ lib
├─ main.dart
├─ unity
├─ unity-project
├─ Assets
├─ pubspec.yaml
- Fastlane Android
desc "Deploy Android"
lane :firebase do
sh "flutter build apk"
# upload_to_play_store
end
- Fastlane iOS
desc "Push a new beta build to TestFlight"
lane :beta do
match
update_code_signing_settings
build_app
# testflight
end
Create 2 file to build and deploy via github action (main_android.yml & main_ios.yml)
- Checkout your source code
- Cache Unity Library
- Build Unity Android
- Set up Flutter
- Fix File permission
- Build and deploy with Fastlane
Because build unity not available on macOS. So we export unity first on ubuntu I. Export Unity on Ubuntu
- Checkout your source code
- Cache Unity Library
- Build Unity Android
- Upload Build to Artifact
II. Build Flutter iOS on MacOS
- Checkout your source code
- Download Build from Artifact
- Set up Flutter
- Fix File permission
- Build and deploy with Fastlane
Note: After export unity. I don't know why we don't have permission to write on our source code. So we need use
chmod
to fix permission