Provider

class in UnityEditor.VersionControl

매뉴얼로 전환

설명

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); } }

정적 변수

activeTaskGets the currently executing task.
enabledReturns true if the version control provider is enabled and a valid Unity Pro License was found.
isActiveReturns true if a version control plugin has been selected and configured correctly.
offlineReasonReturns the reason for the version control provider being offline (if it is offline).
onlineStateReturns the OnlineState of the version control provider.
requiresNetworkThis is true if a network connection is required by the currently selected version control plugin to perform any action.

정적 함수

AddAdds an assets or list of assets to version control.
AddIsValidGiven a list of assets this function returns true if Add is a valid task to perform.
ChangeSetDescriptionGiven a changeset only containing the changeset ID, this will start a task for quering the description of the changeset.
ChangeSetMoveMove an asset or list of assets from their current changeset to a new changeset.
ChangeSetsGet a list of pending changesets owned by the current user.
ChangeSetStatusRetrieves the list of assets belonging to a changeset.
CheckoutCheckout an asset or list of asset from the version control system.
CheckoutIsValidGiven an asset or a list of assets this function returns true if Checkout is a valid task to perform.
ClearCacheThis will invalidate the cached state information for all assets.
DeleteThis will statt a task for deleting an asset or assets both from disk and from version control system.
DeleteChangeSetsStarts a task that will attempt to delete the given changeset.
DeleteChangeSetsIsValidTest if deleting a changeset is a valid task to perform.
DiffHeadStarts a task for showing a diff of the given assest versus their head revision.
DiffIsValidReturn true is starting a Diff task is a valid operation.
GetActiveConfigFieldsReturns the configuration fields for the currently active version control plugin.
GetActivePluginGets the currently user selected verson control plugin.
GetAssetByGUIDReturns version control information about an asset.
GetAssetByPathReturns version control information about an asset.
GetAssetListFromSelectionReturn version control information about the currently selected assets.
GetLatestStart a task for getting the latest version of an asset from the version control server.
GetLatestIsValidReturns true if getting the latest version of an asset is a valid operation.
IncomingStart a task for quering the version control server for incoming changes.
IncomingChangeSetAssetsGiven an incoming changeset this will start a task to query the version control server for which assets are part of the changeset.
IsOpenForEditReturns true if an asset can be edited.
LockAttempt to lock an asset for exclusive editing.
LockIsValidReturn true if the task can be executed.
MergeThis method will initiate a merge task handle merging of the conflicting assets.
MoveUses the version control plugin to move an asset from one path to another.
ResolveStart a task that will resolve conflicting assets in version control.
ResolveIsValidTests if any of the assets in the list is resolvable.
RevertReverts the specified assets by undoing any changes done since last time you synced.
RevertIsValidReturn true if Revert is a valid task to perform.
StatusStart a task that will fetch the most recent status from revision control system.
SubmitStart a task that submits the assets to version control.
SubmitIsValidReturns true if submitting the assets is a valid operation.
UnlockIsValidReturns true if locking the assets is a valid operation.
UpdateSettingsStart a task that sends the version control settings to the version control system.