AssetDatabase

class in UnityEditor

Switch to Manual

Description

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

Static Variables

GlobalArtifactDependencyVersionChanges during Refresh if anything has changed that can invalidate any artifact.
GlobalArtifactProcessedVersionChanges whenever a new artifact is added to the artifact database.
onImportPackageItemsCompletedCallback raised whenever a package import successfully completes that lists the items selected to be imported.

Static Functions

AddObjectToAssetДобавляет objectToAdd к существующему ассету в path.
AllowAutoRefreshDecrements an internal counter which Unity uses to determine whether to allow automatic AssetDatabase refreshing behavior.
AssetPathToGUIDGet the GUID for the asset at path.
CanConnectToCacheServerChecks the availability of the Cache Server.
CanOpenForEditQuery whether an Asset file can be opened for editing in version control and is not exclusively locked by another user or otherwise unavailable.
ClearImporterOverrideClears the importer override for the asset.
ClearLabelsУдаляет все метки, привязанные к ассету.
CloseCacheServerConnectionCloses an active cache server connection. If no connection is active, then it does nothing.
ContainsЯвляется ли объект ассетом?
CopyAssetДублирует ассет в path и сохраняет его в newPath.
CreateAssetСоздаёт новый ресурс по указанному пути.
CreateFolderСоздать новую папку.
DeleteAssetDeletes the specified asset or folder.
DeleteAssetsLets you delete multiple assets or folders at once with performance benefits under version control.
DisallowAutoRefreshIncrements an internal counter which Unity uses to determine whether to allow automatic AssetDatabase refreshing behavior.
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.
GetAvailableImporterTypesGets the importer types associated with a given Asset type.
GetCachedIconВосстанавливает иконку для ассета на данном пути ассета.
GetCacheServerAddressGets the IP address of the Cache Server in Editor Settings.
GetCacheServerEnableDownloadGets the Cache Server Download option from Editor Settings.
GetCacheServerEnableUploadGets the Cache Server Upload option from Editor Settings.
GetCacheServerNamespacePrefixGets the Cache Server Namespace prefix set in Editor Settings.
GetCacheServerPortGets the Port number of the Cache Server in Editor Settings.
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.
GetImporterOverrideReturns the type of the override importer.
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, связанному с ассетом.
GetTypeFromPathAndFileIDGets an object's type from an Asset path and a local file identifier.
GetUnusedAssetBundleNamesReturn all the unused assetBundle names in the asset database.
GUIDFromAssetPathGet the GUID for the asset at path.
GUIDToAssetPathGets the corresponding asset path for the supplied GUID, or an empty string if the GUID can't be found.
ImportAssetИмпорт ассета по пути.
ImportPackageИмпортирует пакет по packagePath в текущий проект.
IsCacheServerEnabledChecks whether the Cache Server is enabled in Project Settings.
IsConnectedToCacheServerChecks connection status of the Cache Server.
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.The "main" Asset is the Asset at the root of a hierarchy (such as a Maya file which may contain multiples meshes and GameObjects).
MakeEditableMakes a file open for editing in version control.
MoveAssetMove an asset file (or folder) from one folder to another.
MoveAssetsToTrashLets you move multiple assets or folders to trash at once with performance benefits under version control.
MoveAssetToTrashMoves the specified asset or folder to the OS trash.
OpenAssetОткрывает ассет с соответствующим приложением.
RefreshИмпорт любых измененных ассетов.
RefreshSettingsApply pending Editor Settings changes to the Asset pipeline.
RegisterCustomDependencyAllows you to register a custom dependency that Assets can be dependent on. If you register a custom dependency, and specify that an Asset is dependent on it, then the Asset will get re-imported if the custom dependency changes.
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Переименуйте файл ассета.
ResetCacheServerReconnectTimerResets the internal cache server connection reconnect timer values. The default delay timer value is 1 second, and the max delay value is 5 minutes. Everytime a connection attempt fails it will double the delay timer value, until a maximum time of the max value.
SaveAssetsЗаписывает все несохраненные изменения на диск.
SetImporterOverrideSets a specific importer to use for the asset.
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.
TryGetGUIDAndLocalFileIdentifierGet the GUID and local file id from an object instance id.
UnregisterCustomDependencyPrefixFilterRemoves custom dependencies that match the prefixFilter.
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.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961