using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ReceiveCommond : MonoBehaviour { public InputField m_Input; // Start is called before the first frame update void Start() { ReadEnvironmentData(); } // Update is called once per frame void Update() { } private void ReadEnvironmentData() { //用来接收HTML发来的数据 string[] CommandLineArgs = Environment.GetCommandLineArgs(); if (CommandLineArgs.Length < 2 || CommandLineArgs[1] == "") { m_Input.text = "没有接收到参数"; //Application.Quit();//启动时没有参数则退出 } else { ParseInitData(CommandLineArgs[1]); } } //解析参数 void ParseInitData(string data) { string[] a = data.Split('&'); //解析参数 m_Input.text = a[1]; } }