unity如何打开外部EXE(数据路径Application.dataPath应用)
1、直接上代码,不用多说。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Diagnostics;
using System.IO;
using UnityEngine.UI;
public class OpenExe : MonoBehaviour {
public Button VrButton;
public Button DanJiButton;
void Start ()
{
VrButton.onClick.AddListener(OpenVR);
DanJiButton.onClick.AddListener(OpenDanJI);
}
public void OpenVR()
{
****string str = Application.dataPath + “/Resources/MyFile/xxx.exe”;
if (File.Exists(str) ==true)
{
Process.Start(str);
}
else if (File.Exists(str) == false)
{
Directory.CreateDirectory(str);
}
}