【背景】 上一篇讲了如何实现运行Unity程序开启某项服务的需求,那么退出Unity时自然就有需求关闭此服务。 【方法】 假设服务是通过某个exe驱动的,在某个Game Object上追加如下代码: using UnityEngine; using System.Diagnostics;public class ExitWithCMDCommand : MonoBehaviour {void Start