1. 程式人生 > >在Unity裡點選按鈕開啟一個瀏覽器頁面 點選關閉 關閉這個頁面

在Unity裡點選按鈕開啟一個瀏覽器頁面 點選關閉 關閉這個頁面

在Unity裡點選按鈕開啟一個瀏覽器頁面  點選關閉 關閉這個頁面

using UnityEngine;
using System.Collections;
using System.Diagnostics;
public class diaoyong : MonoBehaviour {
    public static Process  C;
	void Start () {
      
	}
	void Update () {
	
	}
    void OnGUI()
    {  
        if (GUI.Button(new Rect(50, 50, 100, 30), "新浪"))
        {
            CallWeb();
               
        }
        if (GUI.Button(new Rect(200, 50, 100, 30), "關閉"))
        {
            C.Kill();
        }
       
    }
    void CallWeb()
    {
        C = System.Diagnostics.Process.Start("IExplore.exe", "http://www.sina.com.cn/");
        
    }
}