文档

Unity Engine

Unity Engine

Submit(ChangeSet, AssetList, string, bool)

Starts a task that submits the assets to version control, or saves the changeset to submit later.
阅读时间1 分钟最后更新于 11 天前

Definition

public static Task Submit(ChangeSet changeset, AssetList list, string description, bool saveOnly)

Parameters

changeset

The changeset to submit.

The list of assets to submit.

description

The description of the changeset.

saveOnly

Set to true to save the changeset to submit later, without submitting it. Set to false to submit it.

Returns

Type

Description

TaskThe task that submits the assets to version control, or that only saves the changeset if
saveOnly
is true.

Remarks

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.

Examples

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(); }}