Lock
Starts a task that locks or unlocks a list of assets for exclusive editing.
Read time 1 minuteLast updated 11 days ago
Definition
- Type: Method
- Namespace: UnityEditor.VersionControl
- Assembly: UnityEditor.CoreModule
Lock(AssetList, bool)
Starts a task that locks or unlocks a list of assets for exclusive editing.
public static Task Lock(AssetList assets, bool locked)
Parameters
Returns
Type | Description |
|---|---|
| Task | The task that locks or unlocks the assets. |
Remarks
What a lock does depends on the version control system and server setup. It might prevent other people from editing the asset at all, or only prevent them from submitting it to the server.
Examples
using System.Collections.Generic;using UnityEditor;using UnityEditor.VersionControl;using UnityEngine;public class EditorScript : MonoBehaviour{ [MenuItem("Version Control/Lock")] public static void ExampleLock() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Task t1 = Provider.Checkout(assets, CheckoutMode.Exact); t1.Wait(); Task t2 = Provider.Lock(assets, locked: true); t2.Wait(); }}
Lock(Asset, bool)
Starts a task that locks or unlocks a single asset for exclusive editing.
public static Task Lock(Asset asset, bool locked)
Parameters
Returns
Type | Description |
|---|---|
| Task | The task that locks or unlocks the asset. |
Remarks
What a lock does depends on the version control system and server setup. It might prevent other people from editing the asset at all, or only prevent them from submitting it to the server.