# IsOpenForEdit

> Query which of the provided Asset files are open for editing in version control.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/7000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

## IsOpenForEdit(string\[], List\<string>, StatusQueryOptions)

Query which of the provided Asset files are open for editing in version control.

```csharp
public static void IsOpenForEdit(string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, StatusQueryOptions statusQueryOptions = StatusQueryOptions.UseCachedIfPossible)
```

### Parameters

**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): Paths to Assets or their .meta files, relative to the project folder.**** (\[List\<string>]\(https\://learn.microsoft.com/dotnet/api/system.collections.generic.list-1)): Destination list of non-editable Asset paths.**** (\[StatusQueryOptions]\(/engine/7000.0/script-reference/unityeditor/statusqueryoptions)): Specifies how Unity should query the version control system. The default value is [StatusQueryOptions.UseCachedIfPossible](/engine/7000.0/script-reference/unityeditor/statusqueryoptions/usecachedifpossible.md).

### Remarks

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

## IsOpenForEdit(Object, StatusQueryOptions)

Checks whether an asset object is open for editing in version control.

```csharp
public static bool IsOpenForEdit(Object assetObject, StatusQueryOptions statusOptions)
```

### Parameters

**** (\[Object]\(/engine/7000.0/script-reference/unityengine/object)): The asset object to check.**** (\[StatusQueryOptions]\(/engine/7000.0/script-reference/unityeditor/statusqueryoptions)): How to query the version control system. These options affect the speed and accuracy of the query. The default value is [StatusQueryOptions.UseCachedIfPossible](/engine/7000.0/script-reference/unityeditor/statusqueryoptions/usecachedifpossible.md).

### Returns

| Type                                                          | Description                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the version control system considers the asset open for editing. Otherwise, false. |

### Remarks

Some version control systems only let one user at a time edit certain types of file, to avoid conflicts. In that case, you must open the file for editing, also known as checking it out, before you can edit it. Use this method to check whether a file is open for editing.

Paths outside the project folder, or in folders that aren't under version control such as `Library` or `Temp`, are always open for editing. Paths in packages that aren't local are never open for editing. When no version control system is active, all paths inside the project are open for editing. When one is active, which files count as open depends on the system. For example, in Perforce, files that you added or checked out locally are open for editing.

To check the .meta file of an asset, use [AssetDatabase.IsMetaFileOpenForEdit](/engine/7000.0/script-reference/unityeditor/assetdatabase/ismetafileopenforedit.md).

## IsOpenForEdit(string, StatusQueryOptions)

Checks whether the asset at a path is open for editing in version control.

```csharp
public static bool IsOpenForEdit(string assetOrMetaFilePath, StatusQueryOptions statusOptions)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The project-relative path of the asset file or its .meta file.**** (\[StatusQueryOptions]\(/engine/7000.0/script-reference/unityeditor/statusqueryoptions)): How to query the version control system. These options affect the speed and accuracy of the query. The default value is [StatusQueryOptions.UseCachedIfPossible](/engine/7000.0/script-reference/unityeditor/statusqueryoptions/usecachedifpossible.md).

### Returns

| Type                                                          | Description                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the version control system considers the asset open for editing. Otherwise, false. |

### Remarks

Some version control systems only let one user at a time edit certain types of file, to avoid conflicts. In that case, you must open the file for editing, also known as checking it out, before you can edit it. Use this method to check whether a file is open for editing.

Paths outside the project folder, or in folders that aren't under version control such as `Library` or `Temp`, are always open for editing. Paths in packages that aren't local are never open for editing. When no version control system is active, all paths inside the project are open for editing. When one is active, which files count as open depends on the system. For example, in Perforce, files that you added or checked out locally are open for editing.

To check the .meta file of an asset, use [AssetDatabase.IsMetaFileOpenForEdit](/engine/7000.0/script-reference/unityeditor/assetdatabase/ismetafileopenforedit.md).

## IsOpenForEdit(Object, string, StatusQueryOptions)

Checks whether an asset object is open for editing in version control and gets the reason if it isn't.

```csharp
public static bool IsOpenForEdit(Object assetObject, out string message, StatusQueryOptions statusOptions)
```

### Parameters

**** (\[Object]\(/engine/7000.0/script-reference/unityengine/object)): The asset object to check.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): When the method returns, contains the reason why the asset isn't available for editing, if there is one.**** (\[StatusQueryOptions]\(/engine/7000.0/script-reference/unityeditor/statusqueryoptions)): How to query the version control system. These options affect the speed and accuracy of the query. The default value is [StatusQueryOptions.UseCachedIfPossible](/engine/7000.0/script-reference/unityeditor/statusqueryoptions/usecachedifpossible.md).

### Returns

| Type                                                          | Description                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the version control system considers the asset open for editing. Otherwise, false. |

### Remarks

Some version control systems only let one user at a time edit certain types of file, to avoid conflicts. In that case, you must open the file for editing, also known as checking it out, before you can edit it. Use this method to check whether a file is open for editing.

Paths outside the project folder, or in folders that aren't under version control such as `Library` or `Temp`, are always open for editing. Paths in packages that aren't local are never open for editing. When no version control system is active, all paths inside the project are open for editing. When one is active, which files count as open depends on the system. For example, in Perforce, files that you added or checked out locally are open for editing.

To check the .meta file of an asset, use [AssetDatabase.IsMetaFileOpenForEdit](/engine/7000.0/script-reference/unityeditor/assetdatabase/ismetafileopenforedit.md).

## IsOpenForEdit(string, string, StatusQueryOptions)

Checks whether the asset at a path is open for editing in version control and gets the reason if it isn't.

```csharp
public static bool IsOpenForEdit(string assetOrMetaFilePath, out string message, StatusQueryOptions statusOptions)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The project-relative path of the asset file or its .meta file.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): When the method returns, contains the reason why the asset isn't available for editing, if there is one.**** (\[StatusQueryOptions]\(/engine/7000.0/script-reference/unityeditor/statusqueryoptions)): How to query the version control system. These options affect the speed and accuracy of the query. The default value is [StatusQueryOptions.UseCachedIfPossible](/engine/7000.0/script-reference/unityeditor/statusqueryoptions/usecachedifpossible.md).

### Returns

| Type                                                          | Description                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the version control system considers the asset open for editing. Otherwise, false. |

### Remarks

Some version control systems only let one user at a time edit certain types of file, to avoid conflicts. In that case, you must open the file for editing, also known as checking it out, before you can edit it. Use this method to check whether a file is open for editing.

Paths outside the project folder, or in folders that aren't under version control such as `Library` or `Temp`, are always open for editing. Paths in packages that aren't local are never open for editing. When no version control system is active, all paths inside the project are open for editing. When one is active, which files count as open depends on the system. For example, in Perforce, files that you added or checked out locally are open for editing.

To check the .meta file of an asset, use [AssetDatabase.IsMetaFileOpenForEdit](/engine/7000.0/script-reference/unityeditor/assetdatabase/ismetafileopenforedit.md).
