リポジトリ
使用例
Unity.exe ^
-batchMode ^
-quit ^
-executeMethod Example.Run ^
-myOptionInt 25 ^
-myOptionFloat 2.5 ^
-myOptionString "ピカチュウ" ^
-myOptionBool
using System;
using UniCommandLineParser;
using UnityEngine;
public static class Example
{
private sealed class Options
{
[Option( "batchMode" )]
public bool IsBatchMode { get; private set; }
[Option( "quit" )]
public bool IsQuit { get; private set; }
[Option( "executeMethod" )]
public string ExecuteMethod { get; private set; }
[Option( "myOptionInt" )]
public int MyOptionInt { get; private set; }
[Option( "myOptionFloat" )]
public float MyOptionFloat { get; private set; }
[Option( "myOptionString" )]
public string MyOptionString { get; private set; }
[Option( "myOptionBool" )]
public bool MyOptionBool { get; private set; }
}
private static void Run()
{
var options = CommandLineParser.ParseFromCommandLineArgs<Options>();
Debug.Log( options.IsBatchMode );
Debug.Log( options.IsQuit );
Debug.Log( options.ExecuteMethod );
Debug.Log( options.MyOptionInt );
Debug.Log( options.MyOptionFloat );
Debug.Log( options.MyOptionString );
Debug.Log( options.MyOptionBool );
}
}