Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AssetDatabase

Namespace: UnityEditor

Description

An Interface for accessing assets and performing operations on assets.

Static Functions

AddObjectToAssetAdds objectToAdd to an existing asset at path.
AssetPathToGUIDGet the GUID for the asset at path.
ClearLabelsRemoves all labels attached to an asset.
ContainsIs object an asset?
CopyAssetDuplicates the asset at path and stores it at newPath.
CreateAssetCreates a new asset at path.
CreateFolderCreate a new folder.
DeleteAssetDeletes the asset file at path.
ExportPackageExports the assets identified by assetPathNames to a unitypackage file in fileName.
FindAssetsSearch the assetdatabase using a searchfilter string.
GenerateUniqueAssetPathCreates a new unique path for an asset.
GetAssetOrScenePathReturns the path name relative to the project folder where the asset is stored.
GetAssetPathReturns the path name relative to the project folder where the asset is stored.
GetCachedIconRetrieves an icon for the asset at the given asset path.
GetDependenciesGiven an asset pathName, returns the list of all assets it depends on.
GetLabelsReturns all labels attached to a given asset.
GetTextMetaDataPathFromAssetPathGets the path to the text .meta file associated with an asset.
GUIDToAssetPathTranslate a GUID to its current asset path.
ImportAssetImport asset at path.
ImportPackageImports package at packagePath into the current project.
IsMainAssetIs asset a main asset in the project window?
IsOpenForEditUse IsOpenForEdit to determine if the asset is open for edit by the version control.
IsSubAssetDoes the asset form part of another asset?
LoadAllAssetRepresentationsAtPathReturns all asset representations at assetPath.
LoadAllAssetsAtPathReturns an array of all asset objects at assetPath.
LoadAssetAtPathReturns the first asset object of type type at given path assetPath.
LoadMainAssetAtPathReturns the main asset object at assetPath.
MoveAssetMove an asset file from one folder to another.
MoveAssetToTrashMoves the asset at path to the trash.
OpenAssetOpens the asset with associated application.
RefreshImport any changed assets.
RenameAssetRename an asset file.
SaveAssetsWrites all unsaved asset changes to disk.
SetLabelsReplaces that list of labels on an asset.
StartAssetEditingBegin Asset importing. This lets you group several asset imports together into one larger import.
StopAssetEditingStop Asset importing. This lets you group several asset imports together into one larger import.
ValidateMoveAssetChecks if an asset file can be moved from one folder to another. (Without actually moving the file).
WriteImportSettingsIfDirtyWrites the import settings to disk.