UnlockIsValid
Checks whether unlocking a list of assets is a valid operation.
阅读时间1 分钟最后更新于 11 天前
Definition
- Type: Method
- Namespace: UnityEditor.VersionControl
- Assembly: UnityEditor.CoreModule
UnlockIsValid(AssetList)
Checks whether unlocking a list of assets is a valid operation.
public static bool UnlockIsValid(AssetList assets)
Parameters
The list of assets to check.
Returns
Type | Description |
|---|---|
| bool | True 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 set to false.
lockedExamples
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
The asset to check.
Returns
Type | Description |
|---|---|
| bool | True 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 set to false.
locked