Open jpsarda opened 1 year ago
pls have a look at https://docs.unity3d.com/Manual/CommandLineArguments.html
Just did some experimenting and it seemed to work.
This assumes a recent unitypackage like fuw-2022.1.7 or fuw-2022.2.0
Make sure to setup the Unity project first.
To make an export, choose one of the following functions
DoBuildIOSDebug
DoBuildIOSRelease
DoBuildWebGL
DoBuildAndroidLibraryRelease
DoBuildAndroidLibraryDebug
To launch unity from the command line
Mac /Applications/Unity/Hub/Editor/<version>/Unity.app/Contents/MacOS/Unity -projectPath <unity project path>
Windows "C:\Program Files\Unity\Hub\Editor\<version>\Editor\Unity.exe" -projectPath "<unity project path>"
Now call the function from the command line. iOS release
<path to unity> -projectPath <project path> -batchmode -buildTarget iOS -executeMethod FlutterUnityIntegration.Editor.Build.DoBuildIOSRelease
Android release
<path to unity> -projectPath <project path> -batchmode -buildTarget Android -executeMethod FlutterUnityIntegration.Editor.Build.DoBuildAndroidLibraryRelease
Add -quit
to stop the (hidden) Unity instance when completed.
If this works out, i'll add it to the readme.
I've tried this. The command line I use is
/Applications/Unity/Hub/Editor/2020.3.31f1/Unity.app/Contents/MacOS/Unity -batchmode -buildTarget android -quit -nographics -projectPath ./unity/pt-unity-v1/MiniGamesProject -executeMethod unity.pt-unity-v1.MiniGamesProject.Assets.FlutterUnityIntegration.Editor.Build.DoBuildAndroidLibraryBuild.DoBuildAndroidLibrary
I also tried with iOS:
/Applications/Unity/Hub/Editor/2020.3.31f1/Unity.app/Contents/MacOS/Unity -batchmode -buildTarget iOS -quit -nographics -projectPath ./unity/pt-unity-v1/MiniGamesProject -executeMethod unity.pt-unity-v1.MiniGamesProject.Assets.FlutterUnityIntegration.Editor.Build.DoBuildAndroidLibraryBuild.DoBuildIOS
And for the 2 commands we get this error:
An error occurred while resolving packages: Project has invalid dependencies: com.unity.feature.ar: Package [com.unity.feature.ar@1.0.0] cannot be found com.unity.render-pipelines.universal: Package [com.unity.render-pipelines.universal@12.1.8] cannot be found
It could be related to our project because it uses Vuforia? But when I open teh editor and export for iOS and android, I don't get any error.
I can get my personal project to build using the commands posted above. (Using Arfoundation, Unity 2021.3.21, Flutter 3.7.11, unitypackage 2022.2.0)
If I google com.unity.render-pipelines.universal: Package [com.unity.render-pipelines.universal@12.1.8] cannot be found
, I see people getting that in Unity Cloud Build but not in the local editor.
I believe this is something unrelated to this plugin and probably related to Unity or package manager versions. Can you try to build a regular apk from the command line instead of using any FlutterUnityIntegration build script?
Hello, has anybody managed to export plugins from Unity command line? Thank you.