AssetDatabase Class  

Scripting > Editor Classes > AssetDatabase

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

Class Functions
GenerateUniqueAssetPath

Creates a new unique path for 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

MoveAsset

MoveAssetToTrash

Moves the asset at path to the trash

DeleteAsset

Deletes the asset at path

ImportAsset

Imports the asset at path

CopyAsset

Duplicates the asset at path and stores it at newPath

CreateAsset

Creates a new asset at path. You must ensure that the path uses a supported extension ('.mat' for materials, '.cubemap' for cubemaps, '.GUISkin' for skins, '.anim' for animations and '.asset' for arbitrary other assets.)

AddObjectToAsset

Adds objectToAdd to an existing asset at path.

GetAssetPath

Returns the path name relative to the project folder where the asset is stored

LoadAssetAtPath

Returns the asset at the given path if it inherits from type.

LoadMainAssetAtPath

Returns the main asset at assetPath.

Refresh

Imports any assets that have changed their content modification data or have been added/removed from the project folder.

OpenAsset

Opens the asset target in an external editor, texture application or modelling tool depending on what type of asset it is.

AssetPathToGUID

GUIDToAssetPath

Translate a GUID to it's current asset path

GetCachedIcon

Retrieves an icon for the asset at the given asset path.