Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RevertIsValid

Returns true if Provider.Revert is a valid task to perform on at least one of the given assets in the list.
Read time 1 minuteLast updated 11 days ago

Definition

RevertIsValid(AssetList, RevertMode)

Returns true if Provider.Revert is a valid task to perform on at least one of the given assets in the list.
public static bool RevertIsValid(AssetList assets, RevertMode mode)

Parameters

assets

List of assets to test.

Revert mode to test for.

Returns

Type

Description

bool

Remarks

using System.Collections.Generic;using UnityEditor;using UnityEditor.VersionControl;using UnityEngine;public class EditorScript : MonoBehaviour{ [MenuItem("Version Control/RevertIsValid")] public static void ExampleRevertIsValid() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Debug.Log(Provider.RevertIsValid(assets, RevertMode.Normal)); }}
Do note that, RevertMode.Unchanged will only test locally checked out and locked files. While the RevertMode.Normal will test locally checked out, locked, added and deleted files.

RevertIsValid(Asset, RevertMode)

Returns true if Provider.Revert is a valid task to perform on at least one of the given assets in the list.
public static bool RevertIsValid(Asset asset, RevertMode mode)

Parameters

asset

Asset to test.

Revert mode to test for.

Returns

Type

Description

bool

Remarks

using System.Collections.Generic;using UnityEditor;using UnityEditor.VersionControl;using UnityEngine;public class EditorScript : MonoBehaviour{ [MenuItem("Version Control/RevertIsValid")] public static void ExampleRevertIsValid() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Debug.Log(Provider.RevertIsValid(assets, RevertMode.Normal)); }}
Do note that, RevertMode.Unchanged will only test locally checked out and locked files. While the RevertMode.Normal will test locally checked out, locked, added and deleted files.