Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

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

AssetDatabase

Namespace: UnityEditor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

An Interface for accessing assets and performing operations on assets.

Static Functions

AddObjectToAsset Adds objectToAdd to an existing asset at path.
AssetPathToGUID Get the GUID for the asset at path.
ClearLabels Removes all labels attached to an asset.
Contains Is object an asset?
CopyAsset Duplicates the asset at path and stores it at newPath.
CreateAsset Creates a new asset at path.
CreateFolder Create a new folder.
DeleteAsset Deletes the asset file at path.
ExportPackage Exports the assets identified by assetPathNames to a unitypackage file in fileName.
FindAssets Search the assetdatabase using a searchfilter string.
GenerateUniqueAssetPath Creates a new unique path for an asset.
GetAssetOrScenePath Returns the path name relative to the project folder where the asset is stored.
GetAssetPath Returns the path name relative to the project folder where the asset is stored.
GetCachedIcon Retrieves an icon for the asset at the given asset path.
GetDependencies Given an asset pathName, returns the list of all assets it depends on.
GetLabels Returns all labels attached to a given asset.
GetTextMetaDataPathFromAssetPath Gets the path to the text .meta file associated with an asset.
GUIDToAssetPath Translate a GUID to its current asset path.
ImportAsset Import asset at path.
ImportPackage Imports package at packagePath into the current project.
IsMainAsset Is asset a main asset in the project window?
IsOpenForEdit Use IsOpenForEdit to determine if the asset is open for edit by the version control.
IsSubAsset Does the asset form part of another asset?
LoadAllAssetRepresentationsAtPath Returns all asset representations at assetPath.
LoadAllAssetsAtPath Returns an array of all asset objects at assetPath.
LoadAssetAtPath Returns the first asset object of type type at given path assetPath.
LoadMainAssetAtPath Returns the main asset object at assetPath.
MoveAsset Move an asset file from one folder to another.
MoveAssetToTrash Moves the asset at path to the trash.
OpenAsset Opens the asset with associated application.
Refresh Import any changed assets.
RenameAsset Rename an asset file.
SaveAssets Writes all unsaved asset changes to disk.
SetLabels Replaces that list of labels on an asset.
StartAssetEditing Begin Asset importing. This lets you group several asset imports together into one larger import.
StopAssetEditing Stop Asset importing. This lets you group several asset imports together into one larger import.
ValidateMoveAsset Checks if an asset file can be moved from one folder to another. (Without actually moving the file).
WriteImportSettingsIfDirty Writes the import settings to disk.