Class AssetDatabase
Inheritance
AssetDatabase
Assembly: UnityEditor.dll
Syntax
public sealed class AssetDatabase
Methods
AddObjectToAsset(Object, String)
Declaration
public static void AddObjectToAsset(Object objectToAdd, string path)
Parameters
|
Improve this Doc
View Source
AddObjectToAsset(Object, Object)
Declaration
public static void AddObjectToAsset(Object objectToAdd, Object assetObject)
Parameters
AssetPathToGUID(String)
Declaration
public static string AssetPathToGUID(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
ClearLabels(Object)
Declaration
public static void ClearLabels(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Contains(Int32)
Declaration
public static bool Contains(int instanceID)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Returns
|
Improve this Doc
View Source
Contains(Object)
Declaration
public static bool Contains(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
CopyAsset(String, String)
Declaration
public static bool CopyAsset(string path, string newPath)
Parameters
Returns
CreateAsset(Object, String)
Declaration
public static void CreateAsset(Object asset, string path)
Parameters
CreateFolder(String, String)
Declaration
public static string CreateFolder(string parentFolder, string newFolderName)
Parameters
Type |
Name |
Description |
String |
parentFolder |
|
String |
newFolderName |
|
Returns
DeleteAsset(String)
Declaration
public static bool DeleteAsset(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
|
Improve this Doc
View Source
ExportPackage(String, String)
Declaration
public static void ExportPackage(string assetPathName, string fileName)
Parameters
|
Improve this Doc
View Source
ExportPackage(String, String, ExportPackageOptions)
Declaration
public static void ExportPackage(string assetPathName, string fileName, ExportPackageOptions flags)
Parameters
|
Improve this Doc
View Source
ExportPackage(String[], String)
Declaration
[ExcludeFromDocs]
public static void ExportPackage(string[] assetPathNames, string fileName)
Parameters
Type |
Name |
Description |
String[] |
assetPathNames |
|
String |
fileName |
|
ExportPackage(String[], String, ExportPackageOptions)
Declaration
public static void ExportPackage(string[] assetPathNames, string fileName, [DefaultValue("ExportPackageOptions.Default")] ExportPackageOptions flags)
Parameters
Declaration
public static string ExtractAsset(Object asset, string newPath)
Parameters
Returns
|
Improve this Doc
View Source
FindAssets(String)
Declaration
public static string[] FindAssets(string filter)
Parameters
Type |
Name |
Description |
String |
filter |
|
Returns
|
Improve this Doc
View Source
FindAssets(String, String[])
Declaration
public static string[] FindAssets(string filter, string[] searchInFolders)
Parameters
Type |
Name |
Description |
String |
filter |
|
String[] |
searchInFolders |
|
Returns
|
Improve this Doc
View Source
ForceReserializeAssets()
Declaration
public static void ForceReserializeAssets()
|
Improve this Doc
View Source
ForceReserializeAssets(IEnumerable<String>, ForceReserializeAssetsOptions)
Declaration
public static void ForceReserializeAssets(IEnumerable<string> assetPaths, ForceReserializeAssetsOptions options = ForceReserializeAssetsOptions.ReserializeAssetsAndMetadata)
Parameters
GenerateUniqueAssetPath(String)
Declaration
public static string GenerateUniqueAssetPath(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
GetAllAssetBundleNames()
Declaration
public static string[] GetAllAssetBundleNames()
Returns
GetAllAssetPaths()
Declaration
public static string[] GetAllAssetPaths()
Returns
GetAssetBundleDependencies(String, Boolean)
Declaration
public static string[] GetAssetBundleDependencies(string assetBundleName, bool recursive)
Parameters
Returns
|
Improve this Doc
View Source
GetAssetBundleNames()
Declaration
[Obsolete("Method GetAssetBundleNames has been deprecated. Use GetAllAssetBundleNames instead.")]
public string[] GetAssetBundleNames()
Returns
|
Improve this Doc
View Source
GetAssetDependencyHash(String)
Declaration
public static Hash128 GetAssetDependencyHash(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
GetAssetOrScenePath(Object)
Declaration
public static string GetAssetOrScenePath(Object assetObject)
Parameters
Type |
Name |
Description |
Object |
assetObject |
|
Returns
|
Improve this Doc
View Source
GetAssetPath(Int32)
Declaration
public static string GetAssetPath(int instanceID)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Returns
GetAssetPath(Object)
Declaration
public static string GetAssetPath(Object assetObject)
Parameters
Type |
Name |
Description |
Object |
assetObject |
|
Returns
GetAssetPathFromTextMetaFilePath(String)
Declaration
public static string GetAssetPathFromTextMetaFilePath(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
GetAssetPathsFromAssetBundle(String)
Declaration
public static string[] GetAssetPathsFromAssetBundle(string assetBundleName)
Parameters
Type |
Name |
Description |
String |
assetBundleName |
|
Returns
GetAssetPathsFromAssetBundleAndAssetName(String, String)
Declaration
public static string[] GetAssetPathsFromAssetBundleAndAssetName(string assetBundleName, string assetName)
Parameters
Type |
Name |
Description |
String |
assetBundleName |
|
String |
assetName |
|
Returns
Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedByFirstArgument)]
public static Object GetBuiltinExtraResource(Type type, string path)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public static T GetBuiltinExtraResource<T>(string path)
where T : Object
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
Type Parameters
GetCachedIcon(String)
Declaration
public static Texture GetCachedIcon(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
GetCurrentCacheServerIp()
Declaration
public static string GetCurrentCacheServerIp()
Returns
|
Improve this Doc
View Source
GetDependencies(String)
Declaration
public static string[] GetDependencies(string pathName)
Parameters
Type |
Name |
Description |
String |
pathName |
|
Returns
|
Improve this Doc
View Source
GetDependencies(String, Boolean)
Declaration
public static string[] GetDependencies(string pathName, bool recursive)
Parameters
Returns
|
Improve this Doc
View Source
GetDependencies(String[])
Declaration
public static string[] GetDependencies(string[] pathNames)
Parameters
Type |
Name |
Description |
String[] |
pathNames |
|
Returns
GetDependencies(String[], Boolean)
Declaration
public static string[] GetDependencies(string[] pathNames, bool recursive)
Parameters
Returns
GetImplicitAssetBundleName(String)
Declaration
public static string GetImplicitAssetBundleName(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
GetImplicitAssetBundleVariantName(String)
Declaration
public static string GetImplicitAssetBundleVariantName(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
GetLabels(Object)
Declaration
public static string[] GetLabels(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
GetMainAssetTypeAtPath(String)
Declaration
public static Type GetMainAssetTypeAtPath(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
GetSubFolders(String)
Declaration
public static string[] GetSubFolders(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
|
Improve this Doc
View Source
GetTextMetaDataPathFromAssetPath(String)
Declaration
[Obsolete("GetTextMetaDataPathFromAssetPath has been renamed to GetTextMetaFilePathFromAssetPath (UnityUpgradable) -> GetTextMetaFilePathFromAssetPath(*)")]
public static string GetTextMetaDataPathFromAssetPath(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
GetTextMetaFilePathFromAssetPath(String)
Declaration
public static string GetTextMetaFilePathFromAssetPath(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
GetUnusedAssetBundleNames()
Declaration
public static string[] GetUnusedAssetBundleNames()
Returns
GUIDToAssetPath(String)
Declaration
public static string GUIDToAssetPath(string guid)
Parameters
Type |
Name |
Description |
String |
guid |
|
Returns
|
Improve this Doc
View Source
ImportAsset(String)
Declaration
[ExcludeFromDocs]
public static void ImportAsset(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
ImportAsset(String, ImportAssetOptions)
Declaration
public static void ImportAsset(string path, [DefaultValue("ImportAssetOptions.Default")] ImportAssetOptions options)
Parameters
|
Improve this Doc
View Source
ImportPackage(String, Boolean)
Declaration
public static void ImportPackage(string packagePath, bool interactive)
Parameters
IsForeignAsset(Int32)
Declaration
public static bool IsForeignAsset(int instanceID)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Returns
|
Improve this Doc
View Source
IsForeignAsset(Object)
Declaration
public static bool IsForeignAsset(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
IsMainAsset(Int32)
Declaration
public static bool IsMainAsset(int instanceID)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Returns
|
Improve this Doc
View Source
IsMainAsset(Object)
Declaration
public static bool IsMainAsset(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
IsMainAssetAtPathLoaded(String)
Declaration
public static bool IsMainAssetAtPathLoaded(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
|
Improve this Doc
View Source
Declaration
[Obsolete("AssetDatabase.IsMetaFileOpenForEdit without StatusQueryOptions has been deprecated. Use the version with StatusQueryOptions instead. This will always request the cached status (StatusQueryOptions.UseCachedIfPossible)")]
public static bool IsMetaFileOpenForEdit(Object assetObject)
Parameters
Type |
Name |
Description |
Object |
assetObject |
|
Returns
|
Improve this Doc
View Source
Declaration
[Obsolete("AssetDatabase.IsMetaFileOpenForEdit without StatusQueryOptions has been deprecated. Use the version with StatusQueryOptions instead. This will always request the cached status (StatusQueryOptions.UseCachedIfPossible)")]
public static bool IsMetaFileOpenForEdit(Object assetObject, out string message)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public static bool IsMetaFileOpenForEdit(Object assetObject, out string message, StatusQueryOptions statusOptions)
Parameters
Returns
|
Improve this Doc
View Source
Declaration
public static bool IsMetaFileOpenForEdit(Object assetObject, StatusQueryOptions statusOptions)
Parameters
Returns
IsNativeAsset(Int32)
Declaration
public static bool IsNativeAsset(int instanceID)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Returns
|
Improve this Doc
View Source
IsNativeAsset(Object)
Declaration
public static bool IsNativeAsset(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
|
Improve this Doc
View Source
IsOpenForEdit(String)
Declaration
[Obsolete("AssetDatabase.IsOpenForEdit without StatusQueryOptions has been deprecated. Use the version with StatusQueryOptions instead. This will always request the cached status (StatusQueryOptions.UseCachedIfPossible)")]
public static bool IsOpenForEdit(string assetOrMetaFilePath)
Parameters
Type |
Name |
Description |
String |
assetOrMetaFilePath |
|
Returns
|
Improve this Doc
View Source
IsOpenForEdit(String, out String)
Declaration
[Obsolete("AssetDatabase.IsOpenForEdit without StatusQueryOptions has been deprecated. Use the version with StatusQueryOptions instead. This will always request the cached status (StatusQueryOptions.UseCachedIfPossible)")]
public static bool IsOpenForEdit(string assetOrMetaFilePath, out string message)
Parameters
Type |
Name |
Description |
String |
assetOrMetaFilePath |
|
String |
message |
|
Returns
|
Improve this Doc
View Source
IsOpenForEdit(String, out String, StatusQueryOptions)
Declaration
public static bool IsOpenForEdit(string assetOrMetaFilePath, out string message, StatusQueryOptions statusOptions)
Parameters
Returns
|
Improve this Doc
View Source
IsOpenForEdit(String, StatusQueryOptions)
Declaration
public static bool IsOpenForEdit(string assetOrMetaFilePath, StatusQueryOptions StatusQueryOptions)
Parameters
Returns
|
Improve this Doc
View Source
IsOpenForEdit(Object)
Declaration
[Obsolete("AssetDatabase.IsOpenForEdit without StatusQueryOptions has been deprecated. Use the version with StatusQueryOptions instead. This will always request the cached status (StatusQueryOptions.UseCachedIfPossible)")]
public static bool IsOpenForEdit(Object assetObject)
Parameters
Type |
Name |
Description |
Object |
assetObject |
|
Returns
|
Improve this Doc
View Source
IsOpenForEdit(Object, out String)
Declaration
[Obsolete("AssetDatabase.IsOpenForEdit without StatusQueryOptions has been deprecated. Use the version with StatusQueryOptions instead. This will always request the cached status (StatusQueryOptions.UseCachedIfPossible)")]
public static bool IsOpenForEdit(Object assetObject, out string message)
Parameters
Returns
|
Improve this Doc
View Source
IsOpenForEdit(Object, out String, StatusQueryOptions)
Declaration
public static bool IsOpenForEdit(Object assetObject, out string message, StatusQueryOptions statusOptions)
Parameters
Returns
|
Improve this Doc
View Source
IsOpenForEdit(Object, StatusQueryOptions)
Declaration
public static bool IsOpenForEdit(Object assetObject, StatusQueryOptions StatusQueryOptions)
Parameters
Returns
IsSubAsset(Int32)
Declaration
public static bool IsSubAsset(int instanceID)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Returns
|
Improve this Doc
View Source
IsSubAsset(Object)
Declaration
public static bool IsSubAsset(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
IsValidFolder(String)
Declaration
public static bool IsValidFolder(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
LoadAllAssetRepresentationsAtPath(String)
Declaration
public static Object[] LoadAllAssetRepresentationsAtPath(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
LoadAllAssetsAtPath(String)
Declaration
public static Object[] LoadAllAssetsAtPath(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
LoadAssetAtPath(String, Type)
Declaration
[TypeInferenceRule(TypeInferenceRules.TypeReferencedBySecondArgument)]
public static Object LoadAssetAtPath(string assetPath, Type type)
Parameters
Returns
|
Improve this Doc
View Source
LoadAssetAtPath<T>(String)
Declaration
public static T LoadAssetAtPath<T>(string assetPath)
where T : Object
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
Type Parameters
LoadMainAssetAtPath(String)
Declaration
public static Object LoadMainAssetAtPath(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
MoveAsset(String, String)
Declaration
public static string MoveAsset(string oldPath, string newPath)
Parameters
Returns
MoveAssetToTrash(String)
Declaration
public static bool MoveAssetToTrash(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
|
Improve this Doc
View Source
OpenAsset(Int32)
Declaration
[ExcludeFromDocs]
public static bool OpenAsset(int instanceID)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Returns
OpenAsset(Int32, Int32)
Declaration
public static bool OpenAsset(int instanceID, [DefaultValue("-1")] int lineNumber)
Parameters
Type |
Name |
Description |
Int32 |
instanceID |
|
Int32 |
lineNumber |
|
Returns
|
Improve this Doc
View Source
OpenAsset(Object)
Declaration
[ExcludeFromDocs]
public static bool OpenAsset(Object target)
Parameters
Type |
Name |
Description |
Object |
target |
|
Returns
|
Improve this Doc
View Source
OpenAsset(Object, Int32)
Declaration
public static bool OpenAsset(Object target, [DefaultValue("-1")] int lineNumber)
Parameters
Returns
|
Improve this Doc
View Source
OpenAsset(Object[])
Declaration
public static bool OpenAsset(Object[] objects)
Parameters
Type |
Name |
Description |
Object[] |
objects |
|
Returns
|
Improve this Doc
View Source
Refresh()
Declaration
[ExcludeFromDocs]
public static void Refresh()
Refresh(ImportAssetOptions)
Declaration
public static void Refresh([DefaultValue("ImportAssetOptions.Default")] ImportAssetOptions options)
Parameters
|
Improve this Doc
View Source
RefreshDelayed()
Declaration
[Obsolete("Please use AssetDatabase.Refresh instead", true)]
public static void RefreshDelayed()
|
Improve this Doc
View Source
RefreshDelayed(ImportAssetOptions)
Declaration
[Obsolete("Please use AssetDatabase.Refresh instead", true)]
public static void RefreshDelayed(ImportAssetOptions options)
Parameters
ReleaseCachedFileHandles()
Declaration
public static void ReleaseCachedFileHandles()
RemoveAssetBundleName(String, Boolean)
Declaration
public static bool RemoveAssetBundleName(string assetBundleName, bool forceRemove)
Parameters
Returns
RemoveObjectFromAsset(Object)
Declaration
public static void RemoveObjectFromAsset(Object objectToRemove)
Parameters
Type |
Name |
Description |
Object |
objectToRemove |
|
RemoveUnusedAssetBundleNames()
Declaration
public static void RemoveUnusedAssetBundleNames()
RenameAsset(String, String)
Declaration
public static string RenameAsset(string pathName, string newName)
Parameters
Returns
SaveAssets()
Declaration
public static void SaveAssets()
SetLabels(Object, String[])
Declaration
public static void SetLabels(Object obj, string[] labels)
Parameters
SetMainObject(Object, String)
Declaration
public static void SetMainObject(Object mainObject, string assetPath)
Parameters
StartAssetEditing()
Declaration
public static void StartAssetEditing()
StopAssetEditing()
Declaration
public static void StopAssetEditing()
|
Improve this Doc
View Source
TryGetGUIDAndLocalFileIdentifier(Int32, out String, out Int64)
Declaration
public static bool TryGetGUIDAndLocalFileIdentifier(int instanceID, out string guid, out long localId)
Parameters
Returns
|
Improve this Doc
View Source
TryGetGUIDAndLocalFileIdentifier(Object, out String, out Int64)
Declaration
public static bool TryGetGUIDAndLocalFileIdentifier(Object obj, out string guid, out long localId)
Parameters
Returns
ValidateMoveAsset(String, String)
Declaration
public static string ValidateMoveAsset(string oldPath, string newPath)
Parameters
Returns
WriteImportSettingsIfDirty(String)
Declaration
public static bool WriteImportSettingsIfDirty(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
Events
|
Improve this Doc
View Source
importPackageCancelled
Declaration
public static event AssetDatabase.ImportPackageCallback importPackageCancelled
Event Type
|
Improve this Doc
View Source
importPackageCompleted
Declaration
public static event AssetDatabase.ImportPackageCallback importPackageCompleted
Event Type
|
Improve this Doc
View Source
importPackageFailed
Declaration
public static event AssetDatabase.ImportPackageFailedCallback importPackageFailed
Event Type
|
Improve this Doc
View Source
importPackageStarted
Declaration
public static event AssetDatabase.ImportPackageCallback importPackageStarted
Event Type
Extension Methods