Version: 2020.3
public static VersionControl.Task Submit (VersionControl.ChangeSet changeset, VersionControl.AssetList list, string description, bool saveOnly);

参数

changeset 要提交的变更集。
list 要提交的资源列表。
description 变更集描述。
saveOnly 如果为 true,则仅保存稍后要提交的变更集。

描述

Starts a task that submits the assets to version control.

In version control systems like Git new changes have to be committed and then pushed to the repository separately. In Perforce or Plastic SCM a submit is an all in one task that both commits and pushes the newly made changes all at once.

using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour { [MenuItem("Version Control/Submit")] public static void ExampleSubmit() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Task t = Provider.Submit(new ChangeSet(), assets, "Example Description", saveOnly: false); t.Wait(); } }