Build for Embedded Linux from the command line
Build your Unity project from the command line.
Read time 2 minutesLast updated 22 days ago
To build a Unity project for the Embedded Linux system on the command line interface (CLI), you must have the Unity Editor installed on the build host. The build host can be a Linux, Windows, or macOS machine.
The following example uses the Linux variant of the executable (), but you can replace it with an equivalent executable for your preferred build host's operating system.
UnityCommand line arguments
To instruct Unity to start in CLI mode and build the project at for Embedded Linux, run the following command:
<path-to-unity-project-root>Unity -quit -batchmode -nographics -buildTarget EmbeddedLinux -executeMethod Builder.Build -projectPath <path-to-unity-project-root>
The build process also calls the function to continue with the build setup process.
Builder.BuildBuild script
You can put the example build script for the project to be built from the command line. Use the option to call the method of this class, which sets up the build options and triggers the build.
Assets/Editor/-executeMethodBuild()For more information, refer to the API documentation.
BuildPipeline.BuildPlayerusing UnityEditor;using UnityEditor.Build.Reporting;using UnityEngine;public class Builder{ private static void BuildEmbeddedLinux(EmbeddedLinuxArchitecture architecture) { // Set architecture in BuildSettings EditorUserBuildSettings.selectedEmbeddedLinuxArchitecture = architecture; // Setup build options (e.g. scenes, build output location) var options = new BuildPlayerOptions { // Change to scenes from your project scenes = new[] { "Assets/Scenes/SampleScene.unity", }, // Change to location the output should go locationPathName = "../EmbeddedLinuxPlayer/", options = BuildOptions.CleanBuildCache | BuildOptions.StrictMode, target = BuildTarget.EmbeddedLinux }; var report = BuildPipeline.BuildPlayer(options); if (report.summary.result == BuildResult.Succeeded) { Debug.Log($"Build successful - Build written to {options.locationPathName}"); } else if (report.summary.result == BuildResult.Failed) { Debug.LogError($"Build failed"); } } // This function will be called from the build process public static void Build() { // Build EmbeddedLinux ARM64 Unity player BuildEmbeddedLinux(EmbeddedLinuxArchitecture.Arm64); }}