public static Task Checkout(UnityEngine.Object asset, CheckoutMode mode) { string assetPath = AssetDatabase.GetAssetPath(asset); Asset assetByPath = Provider.GetAssetByPath(assetPath); return(Provider.Internal_Checkout(new Asset[] { assetByPath }, mode)); }
/// <summary> /// <para>Checkout an asset or list of asset from the version control system.</para> /// </summary> /// <param name="assets">List of assets to checkout.</param> /// <param name="mode">Tell the Provider to checkout the asset, the .meta file or both.</param> /// <param name="asset">Asset to checkout.</param> public static Task Checkout(Object[] assets, CheckoutMode mode) { AssetList assetList = new AssetList(); foreach (Object asset in assets) { Asset assetByPath = Provider.GetAssetByPath(AssetDatabase.GetAssetPath(asset)); assetList.Add(assetByPath); } return(Provider.Internal_Checkout(assetList.ToArray(), mode)); }
public static Task Checkout(UnityEngine.Object[] assets, CheckoutMode mode) { AssetList assetList = new AssetList(); for (int i = 0; i < assets.Length; i++) { UnityEngine.Object assetObject = assets[i]; string assetPath = AssetDatabase.GetAssetPath(assetObject); Asset assetByPath = Provider.GetAssetByPath(assetPath); assetList.Add(assetByPath); } return(Provider.Internal_Checkout(assetList.ToArray(), mode)); }
public static bool PromptUserToSaveDirtyScenes(AssetList assetList) { List <Scene> scenes = new List <Scene>(); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene scene = SceneManager.GetSceneAt(i); Asset asset = Provider.GetAssetByPath(scene.path); if (asset != null && asset.IsUnderVersionControl && scene.isDirty) { scenes.Add(scene); } } if (scenes.Count > 0) { List <Scene> filteredScenes = new List <Scene>(); foreach (var asset in assetList) { foreach (var scene in scenes) { if (asset.path.Equals(scene.path)) { filteredScenes.Add(scene); break; } } } if (filteredScenes.Count > 0) { if (!EditorSceneManager.SaveModifiedScenesIfUserWantsTo(filteredScenes.ToArray())) { return(false); } } } return(true); }
/// <summary> /// <para>Checkout an asset or list of asset from the version control system.</para> /// </summary> /// <param name="assets">List of assets to checkout.</param> /// <param name="mode">Tell the Provider to checkout the asset, the .meta file or both.</param> /// <param name="asset">Asset to checkout.</param> public static Task Checkout(Object asset, CheckoutMode mode) { return(Provider.Internal_Checkout(new Asset[1] { Provider.GetAssetByPath(AssetDatabase.GetAssetPath(asset)) }, mode)); }