AssetDatabase

class in UnityEditor

Switch to Manual

Description

Интерфейс для доступа к ассетам и выполнения операций в ассетах.

Static Functions

AddObjectToAssetДобавляет objectToAdd к существующему ассету в path.
AssetPathToGUIDGet the GUID for the asset at path.
ClearLabelsУдаляет все метки, привязанные к ассету.
ContainsЯвляется ли объект ассетом?
CopyAssetДублирует ассет в path и сохраняет его в newPath.
CreateAssetСоздаёт новый ресурс по указанному пути.
CreateFolderСоздать новую папку.
DeleteAssetУдаляет ресурс по указанному пути.
ExportPackageЭкспортирует ассеты, определяемые по assetPathNames к файлу unitypackage в fileName.
ExtractAssetCreates an external Asset from an object (such as a Material) by extracting it from within an imported asset (such as an FBX file).
FindAssetsSearch the asset database using the search filter string.
ForceReserializeAssetsForcibly load and re-serialize the given assets, flushing any outstanding data changes to disk.
GenerateUniqueAssetPathСоздает новый уникальный путь для ассета.
GetAllAssetBundleNamesReturn all the AssetBundle names in the asset database.
GetAssetBundleDependenciesGiven an assetBundleName, returns the list of AssetBundles that it depends on.
GetAssetDependencyHashВозвращает массив всех объектов ассета в assetPath.
GetAssetOrScenePathВозвращает имя пути относительно папки проекта, где хранится ассет.
GetAssetPathВозвращает имя пути относительно папки проекта, где хранится ассет.
GetAssetPathFromTextMetaFilePathПолучает путь к текстовому файлу .meta, связанному с ассетом.
GetAssetPathsFromAssetBundleReturns an array containing the paths of all assets marked with the specified Asset Bundle name.
GetAssetPathsFromAssetBundleAndAssetNameGet the Asset paths for all Assets tagged with assetBundleName and named assetName.
GetCachedIconВосстанавливает иконку для ассета на данном пути ассета.
GetCurrentCacheServerIpGets the IP address of the Cache Server currently in use by the Editor.
GetDependenciesReturns an array of all the assets that are dependencies of the asset at the specified pathName.Note: GetDependencies() gets the Assets that are referenced by other Assets. For example, a Scene could contain many GameObjects with a Material attached to them. In this case, GetDependencies() will return the path to the Material Assets, but not the GameObjects as those are not Assets on your disk.
GetImplicitAssetBundleNameReturns the name of the AssetBundle that a given asset belongs to.
GetImplicitAssetBundleVariantNameReturns the name of the AssetBundle Variant that a given asset belongs to.
GetLabelsВозвращает все метки, прикрепленные к данному ассету.
GetMainAssetTypeAtPathReturns the type of the main asset object at assetPath.
GetSubFoldersGiven a path to a directory in the Assets folder, relative to the project folder, this method will return an array of all its subdirectories.
GetTextMetaFilePathFromAssetPathПолучает путь к текстовому файлу .meta, связанному с ассетом.
GetUnusedAssetBundleNamesReturn all the unused assetBundle names in the asset database.
GUIDToAssetPathGets the corresponding asset path for the supplied guid, or an empty string if the GUID can't be found.
ImportAssetИмпорт ассета по пути.
ImportPackageИмпортирует пакет по packagePath в текущий проект.
IsForeignAssetDetermines whether the Asset is a foreign Asset.
IsMainAssetЯвляется ли ассет главным ассетом в окне проекта?
IsMainAssetAtPathLoadedReturns true if the main asset object at assetPath is loaded in memory.
IsMetaFileOpenForEditQuery whether an asset's metadata (.meta) file is open for edit in version control.
IsNativeAssetDetermines whether the Asset is a native Asset.
IsOpenForEditQuery whether an Asset file is open for editing in version control.
IsSubAssetЯвляется ли форма ассета частью другого ассета?
IsValidFolderGiven a path to a folder, returns true if it exists, false otherwise.
LoadAllAssetRepresentationsAtPathReturns all sub Assets at assetPath.
LoadAllAssetsAtPathReturns an array of all Assets at assetPath.
LoadAssetAtPathВозвращает первый объект ассета типа type по данному пути assetPath.
LoadMainAssetAtPathВозвращает объект главного ассета в assetPath.
MoveAssetMove an asset file (or folder) from one folder to another.
MoveAssetToTrashПеремещает ассет по пути в корзину.
OpenAssetОткрывает ассет с соответствующим приложением.
RefreshИмпорт любых измененных ассетов.
ReleaseCachedFileHandlesCalling this function will release file handles internally cached by Unity. This allows modifying asset or meta files safely thus avoiding potential file sharing IO errors.
RemoveAssetBundleNameRemove the assetBundle name from the asset database. The forceRemove flag is used to indicate if you want to remove it even it's in use.
RemoveObjectFromAssetRemoves object from its asset (See Also: AssetDatabase.AddObjectToAsset).
RemoveUnusedAssetBundleNamesRemove all the unused assetBundle names in the asset database.
RenameAssetПереименуйте файл ассета.
SaveAssetsЗаписывает все несохраненные изменения на диск.
SetLabelsЗаменяет список меток на ассет.
SetMainObjectSpecifies which object in the asset file should become the main object after the next import.
StartAssetEditingStarts importing Assets into the Asset Database. This lets you group several Asset imports together into one larger import.Note: Calling AssetDatabase.StartAssetEditing() places the Asset Database in a state that will prevent imports until AssetDatabase.StopAssetEditing() is called. This means that if an exception occurs between the two function calls, the AssetDatabase will be unresponsive. Therefore, it is highly recommended that you place calls to AssetDatabase.StartAssetEditing() and AssetDatabase.StopAssetEditing() inside either a try..catch block, or a try..finally block as needed.
StopAssetEditingStops importing Assets into the Asset Database. This lets you group several Asset imports together into one larger import.Note: Calling AssetDatabase.StartAssetEditing() places the Asset Database in a state that will prevent imports until AssetDatabase.StopAssetEditing() is called. This means that if an exception occurs between the two function calls, the AssetDatabase will be unresponsive. Therefore, it is highly recommended that you place calls to AssetDatabase.StartAssetEditing() and AssetDatabase.StopAssetEditing() inside either a try..catch block, or a try..finally block as needed.
TryGetGUIDAndLocalFileIdentifier Warning Use the overload with a long localId parameter. Using the overload with an integer localId parameter can cause an integer overflow in localId. This can happen when the object passed to the API is part of a Prefab.Get the GUID and local file id from an object instance id.
ValidateMoveAssetПроверяет, если файл ассета может быть перемещен из одной папки в другую. (Фактически без перемещения файла).
WriteImportSettingsIfDirtyЗаписывает настройки импорта на диск.

Events

importPackageCancelledCallback raised whenever a package import is cancelled by the user.
importPackageCompletedCallback raised whenever a package import successfully completes.
importPackageFailedCallback raised whenever a package import failed.
importPackageStartedCallback raised whenever a package import starts.

Delegates

ImportPackageCallbackDelegate to be called from AssetDatabase.ImportPackage callbacks. packageName is the name of the package that raised the callback.
ImportPackageFailedCallbackDelegate to be called from AssetDatabase.ImportPackage callbacks. packageName is the name of the package that raised the callback. errorMessage is the reason for the failure.