Version: 2021.3
언어: 한국어

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.
hasCheckoutSupportThis is true if the currently selected version control plugin supports the Checkout method.
hasLockingSupportThis is true if the currently selected version control plugin supports the Lock and Unlock methods.
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.
preCheckoutCallbackUser-supplied callback to be called before Version Control check out operation.
preSubmitCallbackUser-supplied callback to be called before Version Control Submit operation.
requiresNetworkThis is true if a network connection is required by the currently selected version control plugin to perform any action.

정적 함수

AddAllows you to add files to version control via script.
AddIsValidGiven 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.
ChangeSetDescriptionGiven a changeset only containing the changeset ID, this will start a task for quering the description of the changeset.
ChangeSetMoveMove an Asset or a list of Assets from their current changeset to a new changeset.
ChangeSetsGets a list of pending changesets owned by the current user.
ChangeSetStatusRetrieves a list of assets belonging to a changeset.
CheckoutCheckout an asset or a list of assets from the version control system.
CheckoutIsValidGiven 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.
ClearCacheThis will invalidate the cached state information for all assets.
DeleteStarts a task to delete an Asset or a list of Assets from the disk and from the version control system.
DeleteChangeSetsStarts a task that will attempt to delete the given changesets.
DeleteChangeSetsIsValidTests if deleting the given changesets is a valid task to perform.
DiffHeadStarts a task for showing a diff of the given assest versus their head revision.
DiffIsValidReturns true if starting a Diff task is a valid operation for at least one asset in the given AssetList.
GetActiveConfigFieldsReturns the configuration fields for the currently active version control plugin.
GetActivePluginGets the current, user selected verson control Plugin.
GetAssetByGUIDReturns version control information about an asset from a given GUID.
GetAssetByPathReturns the version control information about an asset. Can be used with "AssetList.Add" to add assets to a list for further version control actions.
GetAssetListFromSelectionReturns the version control information about the currently selected Assets.
GetLatestStart a task for getting the latest version of an out of sync asset from the version control server.
GetLatestIsValidThe task tests the given asset list and returns true if Provider.GetLatest is valid operation for one or more assets.
IncomingStarts a task that queries 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.
LockIsValidReturns true if the Provider.Lock task can be executed on one or more assets from the given asset list.
MergeInitiates 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.
MoveUses the version control plugin to move an asset from one path to another.
ResolveStarts a task that will resolve the conflicting assets in version control.
ResolveIsValidTests if any of the assets in the list have the conflicted state and can be resolved.
RevertReverts the specified assets by undoing any changes done since the last time you synced.
RevertIsValidReturns true if Provider.Revert is a valid task to perform on at least one of the given assets in the list.
StatusStarts a task that will fetch the most recent status about the asset or assets from the revision control system.
SubmitStarts a task that submits the assets to version control.
SubmitIsValidReturns true if submitting the assets is a valid operation.
UnlockIsValidReturns true if unlocking the assets is a valid operation.
UpdateSettingsStarts a task that sends the version control settings to the version control system.

델리게이트

PreCheckoutCallbackDelegate for a user-supplied callback to be called before Version Control Checkout.
PreSubmitCallbackDelegate for a user-supplied callback to be called before Version Control Submit.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961