public static VersionControl.Task Status (VersionControl.AssetList assets);
public static VersionControl.Task Status (VersionControl.Asset asset);
public static VersionControl.Task Status (VersionControl.AssetList assets, bool recursively);
public static VersionControl.Task Status (VersionControl.Asset asset, bool recursively);
public static VersionControl.Task Status (string[] assets);
public static VersionControl.Task Status (string[] assets, bool recursively);
public static VersionControl.Task Status (string asset);
public static VersionControl.Task Status (string asset, bool recursively);

Parameters

assetsThe asset list to fetch state information for.
assetThe asset to fetch state information for.
recursivelyIf any assets specified are folders this flag will get status for all descendants of the folder as well.

Description

Starts a task that will fetch the most recent status about the asset or assets from the revision control system.

The updated assets can be access through the task's assetList property once it has completed.

using System.Collections.Generic;
using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

public class EditorScript : MonoBehaviour { [MenuItem("Version Control/Status")] public static void ExampleStatus() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Task t = Provider.Status(assets); t.Wait(); t.assetList.ForEach(asset => Debug.Log(asset.name + " " + asset.state.ToString())); } }

The example code above will check the status of the given example asset and its .meta file and output that information into the console.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961