在项目开发过程中,往往会使用到SVN进行项目的版本备份管理,但是每次需要打开本地文件夹才能进行更新或提交SVN的内容。其实Unity提供相应的接口,可以实现一键更新或者提交SVN的内容,可免去很多繁琐的操作,在做Editor工具的时候也可以用到,下面是代码:
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using UnityEngine;
using System;
public class SvnOperater : MonoBehaviour {
[MenuItem("SVN/Update")]
public static void SvnUpdate()
{
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
Process.Start("TortoiseProc.exe", "/command:update /path:" + Application.dataPath + " /closeonend:0");
#endif
}
[MenuItem("SVN/Commit")]
public static void Commit()
{
#if UNITY_STANDALONE_WIN||UNITY_EDITOR
Process.Start("TortoiseProc.exe", "/command:commit /path:" + Application.dataPath + " /closeonend:0");
#endif
}
}
閱讀更多 夢牽魂之淚痕 的文章