Version: 2020.1
LanguageEnglish
  • C#

Provider.GetLatest

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static VersionControl.Task GetLatest(VersionControl.AssetList assets);
public static VersionControl.Task GetLatest(VersionControl.Asset asset);

Parameters

assets List of assets to update.
asset Asset to update.

Description

Start a task for getting the latest version of an out of sync asset from the version control server.

Note that the Provider.GetLatest task does not solve file conflicts, in such cases consider using the Provider.Resolve method as well.

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

public class EditorScript : MonoBehaviour { [MenuItem("Version Control/GetLatest")] public static void ExampleGetLatest() { AssetList assets = new AssetList(); assets.Add(Provider.GetAssetByPath("Assets/ExampleAsset.cs")); Task t = Provider.GetLatest(assets); t.Wait(); } }

Did you find this page useful? Please give it a rating: