Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CanOpenForEdit

Query which of the provided Asset files can be opened for editing in version control and are not remotely locked or otherwise unavailable.
Read time 3 minutesLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor

CanOpenForEdit(string[], List<string>, StatusQueryOptions)

Query which of the provided Asset files can be opened for editing in version control and are not remotely locked or otherwise unavailable.
public static void CanOpenForEdit(string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, StatusQueryOptions statusQueryOptions = StatusQueryOptions.UseCachedIfPossible)

Parameters

assetOrMetaFilePaths

Paths to Assets or their .meta files, relative to the project folder.

outNotEditablePaths

Destination list of non-editable Asset paths.

statusQueryOptions

Specifies how Unity should query the version control system. The default value is StatusQueryOptions.UseCachedIfPossible.

Remarks

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.

CanOpenForEdit(Object, StatusQueryOptions)

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 bool CanOpenForEdit(Object assetObject, StatusQueryOptions statusOptions)

Parameters

assetObject

Object representing the asset whose status you wish to query.

statusOptions

Options for how the version control system should be queried. These options can effect the speed and accuracy of the query. Default is StatusQueryOptions.UseCachedIfPossible.

Returns

Type

Description

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

Remarks

See AssetDatabase.IsOpenForEdit for detailed explanation.

CanOpenForEdit(string, StatusQueryOptions)

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 bool CanOpenForEdit(string assetOrMetaFilePath, StatusQueryOptions statusOptions)

Parameters

assetOrMetaFilePath

Path to the asset file or its .meta file on disk, relative to project folder.

statusOptions

Options for how the version control system should be queried. These options can effect the speed and accuracy of the query. Default is StatusQueryOptions.UseCachedIfPossible.

Returns

Type

Description

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

Remarks

See AssetDatabase.IsOpenForEdit for detailed explanation.

CanOpenForEdit(Object, string, StatusQueryOptions)

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 bool CanOpenForEdit(Object assetObject, out string message, StatusQueryOptions statusOptions)

Parameters

assetObject

Object representing the asset whose status you wish to query.

message

Returns a reason for the asset not being available for edit.

statusOptions

Options for how the version control system should be queried. These options can effect the speed and accuracy of the query. Default is StatusQueryOptions.UseCachedIfPossible.

Returns

Type

Description

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

Remarks

See AssetDatabase.IsOpenForEdit for detailed explanation.

CanOpenForEdit(string, string, StatusQueryOptions)

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 bool CanOpenForEdit(string assetOrMetaFilePath, out string message, StatusQueryOptions statusOptions)

Parameters

assetOrMetaFilePath

Path to the asset file or its .meta file on disk, relative to project folder.

message

Returns a reason for the asset not being available for edit.

statusOptions

Options for how the version control system should be queried. These options can effect the speed and accuracy of the query. Default is StatusQueryOptions.UseCachedIfPossible.

Returns

Type

Description

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

Remarks

See AssetDatabase.IsOpenForEdit for detailed explanation.