5using System.Collections.Generic;
6using System.Diagnostics.CodeAnalysis;
8using Object = UnityEngine.Object;
12 public sealed partial class Asset
19 private const StatusQueryOptions DefaultStatusQueryOption = StatusQueryOptions.UseCachedIfPossible;
39 public static Boolean
CanMakeEditable([NotNull]
Path path, StatusQueryOptions options = DefaultStatusQueryOption)
41 var canOpen = AssetDatabase.CanOpenForEdit(path, out var message, options);
43 SetLastErrorMessage(message);
66 public static Boolean
CanMakeEditable([NotNull] Object asset, StatusQueryOptions options = DefaultStatusQueryOption)
68 ThrowIf.ArgumentIsNull(asset, nameof(asset));
91 StatusQueryOptions options = DefaultStatusQueryOption) =>
111 public static void CanMakeEditable([NotNull] String[] paths, out List<String> notEditablePaths,
112 StatusQueryOptions options = DefaultStatusQueryOption)
114 notEditablePaths =
new List<String>();
115 AssetDatabase.CanOpenForEdit(paths, notEditablePaths, options);
135 public static void CanMakeEditable([NotNull] Object[] assets, out List<String> notEditablePaths,
136 StatusQueryOptions options = DefaultStatusQueryOption) =>
156 public static Boolean
IsMetaEditable([NotNull] Object asset, StatusQueryOptions options = DefaultStatusQueryOption)
158 var isOpen = AssetDatabase.IsMetaFileOpenForEdit(asset, out var message, options);
160 SetLastErrorMessage(message);
182 public static Boolean
IsEditable([NotNull] Object asset, StatusQueryOptions options = DefaultStatusQueryOption)
184 var isOpen = AssetDatabase.IsOpenForEdit(asset, out var message, options);
186 SetLastErrorMessage(message);
205 public static void IsEditable([NotNull]
Path[] paths, out List<String> notEditablePaths,
206 StatusQueryOptions options = DefaultStatusQueryOption) =>
223 public static void IsEditable([NotNull] String[] paths, out List<String> notEditablePaths,
224 StatusQueryOptions options = DefaultStatusQueryOption)
226 notEditablePaths =
new List<String>();
227 AssetDatabase.IsOpenForEdit(paths, notEditablePaths, options);
244 public static void IsEditable([NotNull] Object[] assets, out List<String> notEditablePaths,
245 StatusQueryOptions options = DefaultStatusQueryOption) =>
261 public static Boolean
MakeEditable([NotNull]
Path path) => AssetDatabase.MakeEditable(path);
277 public static Boolean
MakeEditable([NotNull]
Path[] paths, out List<String> notEditablePaths) =>
278 MakeMultipleEditable(
Path.
ToStrings(paths), out notEditablePaths);
294 public static Boolean
MakeEditable([NotNull] String[] paths, out List<String> notEditablePaths) =>
295 MakeMultipleEditable(paths, out notEditablePaths);
314 String prompt =
null) => MakeMultipleEditable(
Path.
ToStrings(paths), out notEditablePaths,
315 prompt !=
null ? prompt :
"Open for Edit?");
334 String prompt =
null) => MakeMultipleEditable(paths, out notEditablePaths,
335 prompt !=
null ? prompt :
"Open for Edit?");
337 private static Boolean MakeMultipleEditable([NotNull] String[] paths, out List<String> notEditablePaths,
338 String prompt =
null)
340 notEditablePaths =
new List<String>();
341 return AssetDatabase.MakeEditable(paths, prompt, notEditablePaths);
static String[] ToStrings([NotNull] IEnumerable< Path > paths)
Converts an IEnumerable collection of Path instances to a string array.
static Path Get([NotNull] Object asset)
Gets the relative path of an asset.
Represents a relative path to an asset file or folder, typically under 'Assets' or 'Packages'.
static void IsEditable([NotNull] Path[] paths, out List< String > notEditablePaths, StatusQueryOptions options=DefaultStatusQueryOption)
Tests if the assets can be opened for editing in the version control system.
static Boolean MakeEditable([NotNull] String[] paths, out List< String > notEditablePaths)
Tries to open multiple paths for editing in the version control system.
static Boolean IsEditable([NotNull] Object asset, StatusQueryOptions options=DefaultStatusQueryOption)
Returns true if the asset file is open for editing in the version control system.
static void CanMakeEditable([NotNull] Object[] assets, out List< String > notEditablePaths, StatusQueryOptions options=DefaultStatusQueryOption)
Tests which assets can be made editable and provides a list of paths that cannot be opened for editin...
static Boolean MakeEditable([NotNull] Path path)
Tries to open the path for editing in the version control system.
static Boolean CanMakeEditable([NotNull] Path path, StatusQueryOptions options=DefaultStatusQueryOption)
Returns true if the asset can be opened for editing in the version control system.
static Boolean CanMakeEditable([NotNull] Object asset, StatusQueryOptions options=DefaultStatusQueryOption)
Returns true if the asset can be opened for editing in the version control system.
static void CanMakeEditable([NotNull] Path[] paths, out List< String > notEditablePaths, StatusQueryOptions options=DefaultStatusQueryOption)
Tests which assets can be made editable and provides a list of paths that cannot be opened for editin...
static Boolean MakeEditableInteractive([NotNull] String[] paths, out List< String > notEditablePaths, String prompt=null)
Tries to open multiple paths for editing in the version control system. Shows a prompt to the user un...
static Boolean IsMetaEditable([NotNull] Object asset, StatusQueryOptions options=DefaultStatusQueryOption)
Returns true if the meta file is open for editing in the version control system.
static Boolean MakeEditable([NotNull] Path[] paths, out List< String > notEditablePaths)
Tries to open multiple paths for editing in the version control system.
static void CanMakeEditable([NotNull] String[] paths, out List< String > notEditablePaths, StatusQueryOptions options=DefaultStatusQueryOption)
Tests which assets can be made editable and provides a list of paths that cannot be opened for editin...
static Boolean MakeEditableInteractive([NotNull] Path[] paths, out List< String > notEditablePaths, String prompt=null)
Tries to open multiple paths for editing in the version control system. Shows a prompt to the user un...
static void IsEditable([NotNull] String[] paths, out List< String > notEditablePaths, StatusQueryOptions options=DefaultStatusQueryOption)
Tests if the assets can be opened for editing in the version control system.
static void IsEditable([NotNull] Object[] assets, out List< String > notEditablePaths, StatusQueryOptions options=DefaultStatusQueryOption)
Tests if the assets can be opened for editing in the version control system.
Groups version control related functionality.