Version: 2021.3
public static bool CanOpenForEdit (Object assetObject, StatusQueryOptions statusOptions= StatusQueryOptions.UseCachedIfPossible);
public static bool CanOpenForEdit (string assetOrMetaFilePath, StatusQueryOptions statusOptions= StatusQueryOptions.UseCachedIfPossible);
public static bool CanOpenForEdit (Object assetObject, out string message, StatusQueryOptions statusOptions= StatusQueryOptions.UseCachedIfPossible);
public static bool CanOpenForEdit (string assetOrMetaFilePath, out string message, StatusQueryOptions statusOptions= StatusQueryOptions.UseCachedIfPossible);

参数

assetObject 一个代表要查询其状态的资源的对象。
assetOrMetaFilePath 资源文件或其 .meta 文件在磁盘上的路径,此路径是相对于项目文件夹的路径。
message Returns a reason for the asset not being available for edit.
statusOptions 有关应如何查询版本控制系统的选项。这些选项可能会影响查询的速度和准确性。默认值为 StatusQueryOptions.UseCachedIfPossible

返回

bool True if the asset is considered available for edit by the selected version control system.

描述

Query whether an Asset file can be opened for editing in version control and is not exclusively locked by another user or otherwise unavailable.


public static void CanOpenForEdit (string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, StatusQueryOptions statusQueryOptions= StatusQueryOptions.UseCachedIfPossible);

参数

assetOrMetaFilePaths 资源或其 .meta 文件的路径,相对于项目文件夹。
outNotEditablePaths 不可编辑的资源路径的目标列表。
statusQueryOptions 指定 Unity 应如何查询版本控制系统。默认值为 StatusQueryOptions.UseCachedIfPossible

描述

Query which of the provided Asset files can be opened for editing in version control and are not remotely locked or otherwise unavailable.

This variant of the CanOpenForEdit function can query multiple Asset paths at once. It writes paths for Assets that are not 'available for edit' into the outNotEditablePaths list.