文档

Unity Engine

Unity Engine

UnlockIsValid

Checks whether unlocking a list of assets is a valid operation.
阅读时间1 分钟最后更新于 11 天前

Definition

UnlockIsValid(AssetList)

Checks whether unlocking a list of assets is a valid operation.
public static bool UnlockIsValid(AssetList assets)

Parameters

assets

The list of assets to check.

Returns

Type

Description

boolTrue if unlocking the assets is a valid operation. Otherwise, false.

Remarks

Use this method to check whether an unlock can succeed before you start one, for example before you call Provider.Lock with
locked
set to false.

Examples

using System.Collections.Generic;using UnityEditor;using UnityEditor.VersionControl;using UnityEngine;public class EditorScript : MonoBehaviour{ [MenuItem("Version Control/UnlockIsValid")] public static void ExampleUnlockIsValid() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Debug.Log(Provider.UnlockIsValid(assets)); }}

UnlockIsValid(Asset)

Checks whether unlocking a single asset is a valid operation.
public static bool UnlockIsValid(Asset asset)

Parameters

asset

The asset to check.

Returns

Type

Description

boolTrue if unlocking the asset is a valid operation. Otherwise, false.

Remarks

Use this method to check whether an unlock can succeed before you start one, for example before you call Provider.Lock with
locked
set to false.