Version: Unity 6.0 (6000.0)
言語 : 日本語
QNX ビルドプロファイルリファレンス
QNX プロジェクトのデプロイ

コマンドラインからの QNX 用のビルド

コマンドラインインターフェース (CLI) で QNX システム用の Unity プロジェクトをビルドするには、Unity エディターをビルドホストにインストールする必要があります。ビルドホストは Linux OS を実行し、QNX SDK もインストールされている必要があります。詳細については、QNX 用 Unity エディターのインストール を参照してください。

以下の例では、Linux バリアントの実行ファイル (Unity) を使用していますが、好みのビルドホストの OS 用の同等の実行ファイルに置き換えることができます。

コマンドライン引数

前提条件

コマンドラインを使用してプロジェクトをビルドする前に、以下の手順に従ってください。

Unity に、CLI モードで開始し、<path-to-unity-project-root> に QNX 用のプロジェクトをビルドするように指示するには、以下のコマンドを実行します。

Unity -quit -batchmode -nographics -buildTarget QNX -executeMethod Builder.Build -projectPath <path-to-unity-project-root>

ビルドプロセスは、Builder.Build 関数も呼び出してビルド設定を続行します。

ビルドスクリプト

コマンドラインから、ビルドするプロジェクトの Assets/Editor/ にサンプルビルドスクリプトを追加できます。-executeMethod オプションを使用して、このクラスの Build() メソッドを呼び出します。これにより、ビルドオプションが設定され、ビルドがトリガーされます。

詳細については、BuildPipeline.BuildPlayerドキュメント を参照してください。

using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;

public class Builder
{
    private static void BuildQNX(QNXOsVersion qnxVersion, QNXArchitecture architecture)
    {
        // Set QNX version in BuildSettings
        EditorUserBuildSettings.selectedQnxOsVersion = qnxVersion;

        // Set architecture in BuildSettings
        EditorUserBuildSettings.selectedQnxArchitecture = 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 = "../QNXPlayer/",
            options = BuildOptions.CleanBuildCache | BuildOptions.StrictMode,
            target = BuildTarget.QNX
        };

        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 QNX 7.1 ARM64 Unity player
        BuildQNX(QNXOsVersion.Neutrino71, QNXArchitecture.Arm64);
    }
}

追加リソース

QNX ビルドプロファイルリファレンス
QNX プロジェクトのデプロイ