Version: 2020.2

Provider.SubmitIsValid

切换到手册
public static bool SubmitIsValid (VersionControl.ChangeSet changeset, VersionControl.AssetList assets);

参数

changeset 要提交的变更集。
assets 要提交的资源。

描述

如果提交资源是有效操作,则返回 true。

Do note that the task will always return true if the changeset parameter is set to an existing changeset.

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

public class EditorScript : MonoBehaviour { [MenuItem("Version Control/SubmitIsValid")] public static void ExampleSubmitIsValid() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Debug.Log(Provider.SubmitIsValid(null, assets)); } }