This class provides access to the version control API.
Note that the Version Control window is refreshed after every version control operation. This means that looping through multiple assets and doing an individual operation on each (i.e. Checkout) will be slower than passing an AssetList containing all of the assets and performing a version control operation on it once.
using System.Collections.Generic; using UnityEditor; using UnityEditor.VersionControl; using UnityEngine;
public class EditorScript : MonoBehaviour { [MenuItem("VC/Checkout")] public static void TestCheckout() { AssetList assets = new AssetList(); assets.Add(new Asset("Assets/"));
Task t = Provider.Checkout(assets, CheckoutMode.Both); t.Wait(); } }
Also note that Provider operations just execute the VCS commands, and do not automatically refresh the Version Control window. To update this window, use Task.SetCompletionAction.
using System.Collections.Generic; using UnityEditor; using UnityEditor.VersionControl; using UnityEngine;
public class EditorScript : MonoBehaviour { [MenuItem("VC/ChangeSetMove")] static void ChangeSetMove() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/testMaterial.mat")); Task task = Provider.ChangeSetMove(assets, "ChangeSetID"); task.SetCompletionAction(CompletionAction.UpdatePendingWindow); } }
activeTask | 現在実行中のタスクを取得します。 |
enabled | バージョン管理プロバイダーが有効であり、有効な Unity Pro ライセンスがあった場合、 True を返します。 |
isActive | バージョン管理プラグインが選択され、正しく構成されている場合、 True を返します。 |
offlineReason | バージョン管理プロバイダーがオフラインになっている理由を返します (オフラインの場合) 。 |
onlineState | バージョン管理プロバイダーの OnlineState を返します。 |
preCheckoutCallback | User-supplied callback to be called before Version Control check out operation. |
preSubmitCallback | User-supplied callback to be called before Version Control Submit operation. |
requiresNetwork | 現在選択されているバージョン管理プラグインがなにかを実行するためにネットワーク接続が必要な場合、これは True です。 |
Add | Allows you to add files to version control via script. |
AddIsValid | Given a list of assets this function returns true if Provider.Add is a valid task to perform on at least one of the assets in the list. |
ChangeSetDescription | チェンジセット ID のみを含むチェンジセットを与えると、チェンジセットの説明をクエリするタスクを開始します。 |
ChangeSetMove | Move an Asset or a list of Assets from their current changeset to a new changeset. |
ChangeSets | Gets a list of pending changesets owned by the current user. |
ChangeSetStatus | Retrieves a list of assets belonging to a changeset. |
Checkout | Checkout an asset or a list of assets from the version control system. |
CheckoutIsValid | Given an asset or a list of assets this function returns true if Provider.Checkout is a valid task to perform on at least one of the given assets. |
ClearCache | すべてのアセットのキャッシュされていたステート情報は無効になります。 |
Delete | Starts a task to delete an Asset or a list of Assets from the disk and from the version control system. |
DeleteChangeSets | Starts a task that will attempt to delete the given changesets. |
DeleteChangeSetsIsValid | Tests if deleting the given changesets is a valid task to perform. |
DiffHead | 指定したアセットとそれらの Head リビジョンとの差分を表示するタスクを開始します。 |
DiffIsValid | Returns true if starting a Diff task is a valid operation for at least one asset in the given AssetList. |
GetActiveConfigFields | 現在のアクティブなバージョン管理プラグインの Configuration フィールドを返します。 |
GetActivePlugin | Gets the current, user selected verson control Plugin. |
GetAssetByGUID | Returns version control information about an asset from a given GUID. |
GetAssetByPath | Returns the version control information about an asset. Can be used with "AssetList.Add" to add assets to a list for further version control actions. |
GetAssetListFromSelection | Returns the version control information about the currently selected Assets. |
GetLatest | Start a task for getting the latest version of an out of sync asset from the version control server. |
GetLatestIsValid | The task tests the given asset list and returns true if Provider.GetLatest is valid operation for one or more assets. |
Incoming | Starts a task that queries the version control server for incoming changes. |
IncomingChangeSetAssets | Incoming チェンジセットを与えると、アセットがチェンジセットの一部であるバージョン管理サーバーの照会を実行するタスクが開始されます。 |
IsOpenForEdit | アセットを編集できる場合、 True を返します。 |
Lock | 排他的な編集のためにアセットをロックすることを試します。 |
LockIsValid | Returns true if the Provider.Lock task can be executed on one or more assets from the given asset list. |
Merge | Initiates a merge task to handle the merging of conflicting Assets. This invokes a merge tool, which you can set in the External Tools section of the Preferences window, on the conflicting Assets. When the merge task finishes, the AssetList only contains the Assets that the tool could merge. |
Move | バージョン管理プラグインを使用して、アセットをひとつのパスから別のに移動します。 |
Resolve | Starts a task that will resolve the conflicting assets in version control. |
ResolveIsValid | Tests if any of the assets in the list have the conflicted state and can be resolved. |
Revert | Reverts the specified assets by undoing any changes done since the last time you synced. |
RevertIsValid | Returns true if Provider.Revert is a valid task to perform on at least one of the given assets in the list. |
Status | Starts a task that will fetch the most recent status about the asset or assets from the revision control system. |
Submit | Starts a task that submits the assets to version control. |
SubmitIsValid | アセットを送信するのが有効な操作の場合、True を返します。 |
UnlockIsValid | Returns true if unlocking the assets is a valid operation. |
UpdateSettings | Starts a task that sends the version control settings to the version control system. |
PreCheckoutCallback | Delegate for a user-supplied callback to be called before Version Control Checkout. |
PreSubmitCallback | Delegate for a user-supplied callback to be called before Version Control Submit. |