Unity3D-获取命令行启动参数

using UnityEngine;
using System.Collections;
using System;
using UnityEngine.UI;
using System.Linq;

public class CmdTest : MonoBehaviour {

    public Text text1;
    public Text text2;

    // Use this for initialization
    void Start()
    {
        string CommandLine = Environment.CommandLine;
        string[] CommandLineArgs = Environment.GetCommandLineArgs();
        text1.text = "CommandLine : " + CommandLine;
        text2.text = CommandLineArgs.Aggregate<string, string>(
            "CommandLineArgs : ",
            (a, b) => a + " , " + b);
    }

}

编辑器下:
Unity3D-获取命令行启动参数_第1张图片

打包PC下(直接启动):
Unity3D-获取命令行启动参数_第2张图片

打包PC下(命令行启动):
Unity3D-获取命令行启动参数_第3张图片
Unity3D-获取命令行启动参数_第4张图片

你可能感兴趣的:(Unity)