5using System.Diagnostics.CodeAnalysis;
6using System.Reflection;
12using Object = UnityEngine.Object;
16 public sealed partial class Asset
36 return AssetDatabase.GetImporterType(path);
52 return AssetDatabase.GetImporterType(guid);
92 public static Type[]
GetActive([NotNull] String[] paths)
94 return AssetDatabase.GetImporterTypes(paths);
108 public static Type[]
GetActive(ReadOnlySpan<GUID> guids)
110 return AssetDatabase.GetImporterTypes(guids);
124 return AssetDatabase.GetAvailableImporters(path);
150 return AssetDatabase.GetDefaultImporter(path);
176 public static Type
GetOverride([NotNull]
Path path) => AssetDatabase.GetImporterOverride(path);
204 where T : AssetImporter
206 AssetDatabase.SetImporterOverride<T>(path);
221 public static void ClearOverride([NotNull]
Path path) => AssetDatabase.ClearImporterOverride(path);
251 [ExcludeFromCodeCoverage]
252 public static void ApplySettings([NotNull]
Path path) => AssetDatabase.WriteImportSettingsIfDirty(path);
254 internal static void SetImporterOverride([NotNull] Type value, [NotNull] String assetPath)
256 var methodName =
"SetImporterOverride";
257 var bindingFlags = BindingFlags.Public | BindingFlags.Static;
258 var methodInfo = typeof(AssetDatabase).GetMethod(methodName, bindingFlags).MakeGenericMethod(value);
259 methodInfo.Invoke(
null,
new System.Object[] { assetPath });
static GUID GetGuid([NotNull] Object asset)
Returns the GUID of an object. Returns an empty GUID if the object is null or not an asset.
Groups file related operations.
static Type GetDefault([NotNull] Path path)
Returns an asset's default importer type.
static void ApplySettings([NotNull] Path path)
Writes any unsaved changes of the given asset's importer to disk.
static Type GetActive([NotNull] Path path)
Gets the active AssetImporter type used for the given asset.
static Type GetActive([NotNull] Object asset)
Gets the active AssetImporter type used for the given asset.
static Type GetActive(GUID guid)
Gets the active AssetImporter type used for the given asset.
static Type[] GetActive(ReadOnlySpan< GUID > guids)
Gets the active AssetImporter types used for the given assets.
static Type GetDefault([NotNull] Object asset)
Returns an asset's default importer type.
static Type GetOverride([NotNull] Object asset)
Returns an asset's overridden importer type.
static Type[] GetAvailable([NotNull] Object asset)
Gets the available AssetImporter types for assets of this kind.
static Boolean IsOverridden([NotNull] Path path)
Returns true if the AssetImporter type for this asset has been overridden.
static Type[] GetActive([NotNull] String[] paths)
Gets the active AssetImporter types used for the given assets.
static void ClearOverride([NotNull] Path path)
Clears an AssetImporter override for the specified asset.
static Type GetOverride([NotNull] Path path)
Returns an asset's overridden importer type.
static Type[] GetActive([NotNull] Path[] paths)
Gets the active AssetImporter types used for the given assets.
static void SetOverride< T >([NotNull] Path path)
Sets the custom AssetImporter to use for the specified asset.
static Type[] GetAvailable([NotNull] Path path)
Gets the available AssetImporter types for assets of this kind.
Groups all AssetImporter related functionality.
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'.
Replacement implementation for Unity's massive AssetDatabase class with a cleaner interface and more ...