Unity中实现调用Windows的开机重启
以下为实现代码
using System.Diagnostics;
using UnityEngine;
public class WindowsSystemControl : MonoBehaviour
{
[ContextMenu("关机")]
public void Shutdown()
{
Process.Start("shutdown", "/s /t 0");
}
[ContextMenu("重启")]
public void Restart()
{
Process.Start("shutdown", "/r /t 0");
}
}