Version: 2020.1
언어: 한국어

AssetDatabase

class in UnityEditor

매뉴얼로 전환

설명

An Interface for accessing assets and performing operations on assets.

정적 변수

onImportPackageItemsCompletedCallback raised whenever a package import successfully completes that lists the items selected to be imported.

정적 함수

AddObjectToAssetAdds objectToAdd to an existing asset at 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.
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.
CreateFolderCreates a new folder, in the specified parent folder.The parent folder string must start with the "Assets" folder, and all folders within the parent folder string must already exist. For example, when specifying "Assets/ParentFolder1/Parentfolder2/", the new folder will be created in "ParentFolder2" only if ParentFolder1 and ParentFolder2 already exist.
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.
ExportPackageExports the assets identified by assetPathNames to a unitypackage file in 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.
GenerateUniqueAssetPathCreates a new unique path for an asset.
GetAllAssetBundleNamesReturn all the AssetBundle names in the asset database.
GetAssetBundleDependenciesGiven an assetBundleName, returns the list of AssetBundles that it depends on.
GetAssetDependencyHashReturns the hash of all the dependencies of 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.
GetAssetPathFromTextMetaFilePathGets the path to the asset file associated with a text .meta file.
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.
GetCachedIconRetrieves an icon for the asset at the given asset path.
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.
GetLabelsReturns all labels attached to a given asset.
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.
GetTextMetaFilePathFromAssetPathGets the path to the text .meta file associated with an asset.
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.
ImportAssetImport asset at path.
ImportPackageImports package at packagePath into the current project.
IsForeignAssetDetermines whether the Asset is a foreign Asset.
IsMainAssetIs asset a main asset in the project window?
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.
IsSubAssetDoes the asset form part of another asset?
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.
LoadAssetAtPathReturns the first asset object of type type at given path assetPath.
LoadMainAssetAtPathReturns the main asset object at assetPath.
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.
OpenAssetOpens the asset with associated application.
RefreshImport any changed assets.
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.
RenameAssetRename an asset file.
SaveAssetsWrites all unsaved asset changes to disk.
SetLabelsReplaces that list of labels on an asset.
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.
ValidateMoveAssetChecks if an asset file can be moved from one folder to another. (Without actually moving the file).
WriteImportSettingsIfDirtyWrites the import settings to disk.

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.

델리게이트

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.