Version: 2022.3
言語: 日本語

AssetDatabase

class in UnityEditor

マニュアルに切り替える

説明

アセットにアクセスし、操作するためのインターフェースです。

Static 変数

ActiveRefreshImportModeGets the refresh import mode currently in use by the asset database.
DesiredWorkerCountThe desired number of processes to use when importing assets, during an asset database refresh.
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 関数

AddObjectToAsset path に存在するアセットに objectToAdd を追加
AllowAutoRefreshDecrements an internal counter which Unity uses to determine whether to allow automatic AssetDatabase refreshing behavior.
AssetPathToGUIDアセットのパスから GUID を取得します
CanConnectToCacheServerChecks the availability of the Cache Server.
CanOpenAssetInEditorChecks if Unity can open an asset in the Editor.
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アセットをコピーします。
CreateAssetCreates a new native Unity asset.
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.
ExportPackage**fileName** という名の unitypackage ファイルとして **assetPathNames** からアセットをエクスポートします
ExtractAssetインポートされたアセット (FBX ファイルなど) から抽出することにより、オブジェクト (マテリアルなど) から外部アセットを作成します。
FindAssetsフィルター検索の文字列を使ってアセットデータベースを検索します。
ForceReserializeAssets指定されたアセットを強制的にロードして再シリアライズし、残っているデータ変更をディスクに送ります。
ForceToDesiredWorkerCountForces the Editor to use the desired amount of worker processes. Unity will either spawn new worker processes or shut down idle worker processes to reach the desired number.
GenerateUniqueAssetPathアセットのためのユニークなパスを作成します
GetAllAssetBundleNamesアセットデータベースにある、全アセットバンドルの名称を返します。
GetAssetBundleDependenciesGiven an assetBundleName, returns the list of AssetBundles that it depends on.
GetAssetDependencyHashアセットのすべての依存関係のハッシュを返します
GetAssetOrScenePathアセットが保存されているプロジェクトフォルダーのパス名を返します。
GetAssetPathアセットが保存されているプロジェクトフォルダーのパス名を返します。
GetAssetPathFromTextMetaFilePathテキスト形式の .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.
GetAvailableImportersGets the importer types associated with a given Asset path.
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.
GetCurrentCacheServerIp現在、エディターによって使用中のキャッシュサーバーの IP アドレスを取得します。
GetDefaultImporterReturns the Default Importer associated with the asset located at the supplied path. When no Importer override is set, then the default importer is used. See Also: AssetDatabase.GetImporterOverride, AssetDatabase.ClearImporterOverride.
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.
GetImplicitAssetBundleName指定のアセットが属する AssetBundle の名を返します。
GetImplicitAssetBundleVariantName指定のアセットが属する AssetBundle バリアントの名を返します。
GetImporterOverrideReturns the type of the override importer.
GetImporterTypeReturns the type of importer associated with an asset without loading the asset.
GetImporterTypesReturns the types of importers associated with the specified array of assets, without loading those assets.
GetLabelsアセットのラベルをすべて取得します
GetMainAssetTypeAtPath assetPath のメインアセットオブジェクトのタイプを返します。
GetSubFoldersAssetsフォルダー内のディレクトリへの相対パス (プロジェクトフォルダー基準) を指定すると、このメソッドはそのすべてのサブディレクトリの配列を返します。
GetTextMetaFilePathFromAssetPathアセットのパスから、.meta ファイルのパスを取得します
GetTypeFromPathAndFileIDGets an object's type from an Asset path and a local file identifier.
GetUnusedAssetBundleNamesアセットデータベースで、使用されていないアセットバンドル名すべてを返します
GUIDFromAssetPathアセットのパスから GUID を取得します
GUIDToAssetPathGets the corresponding asset path for the supplied GUID, or an empty string if the GUID can't be found.
ImportAssetパスからアセットをインポートします
ImportPackage現在のプロジェクトに **packagePath** を使用して unitypackage をインポートします。
InstanceIDsToGUIDsSets a NativeArray of UnityEditor.GUIDs for every valid Instance ID that is an asset.
IsCacheServerEnabledChecks whether the Cache Server is enabled in Project Settings.
IsConnectedToCacheServerChecks connection status of the Cache Server.
IsDirectoryMonitoringEnabledReports whether Directory Monitoring is enabled.
IsForeignAssetアセットが外部アセットかどうかを判断します。
IsMainAssetアセットがプロジェクトウインドウでメインのアセットかどうか。
IsMainAssetAtPathLoaded assetPath の主要アセットオブジェクトがメモリにロードされる場合は、true を返します。
IsMetaFileOpenForEditアセットのメタデータ (.meta) ファイルがバージョン管理で編集のために開いているかどうかを照会します。
IsNativeAssetアセットがネイティブアセットであるかどうかを判断します。
IsOpenForEditQuery whether an Asset file is open for editing in version control.
IsSubAssetこのアセットが他のアセットの一部かどうか。
IsValidFolderフォルダーへのパスを指定すると、存在する場合は true、そうでない場合は false を返します。
LoadAllAssetRepresentationsAtPath assetPath のすべてのサブアセットを返します。
LoadAllAssetsAtPath assetPath のすべてのアセットを含む配列を返します。
LoadAssetAtPath指定のパス **assetPath** で、型が **type** である最初のアセットオブジェクトを返します。
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).
LoadObjectAsyncLoads a specific Object and its dependencies from an Asset file asynchronously.
MakeEditableMakes a file open for editing in version control.
MoveAssetアセットファイル (または、フォルダー) を、あるフォルダーから別のフォルダーに移動します。
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.
ReleaseCachedFileHandlesこの関数を呼び出すと、Unity によって内部的にキャッシュされたファイルハンドルが解放されます。 これにより、アセットまたはメタファイルを安全に変更できるため、ファイル共有 IO エラーの可能性を回避できます。
RemoveAssetBundleNameアセットデータベースから、アセットバンドル名を削除します。使用中のものでも削除したい場合は、 forceRemove のフラグを立ててください。
RemoveObjectFromAssetアセットからオブジェクトを削除します ( AssetDatabase.AddObjectToAsset 参照)。
RemoveUnusedAssetBundleNamesアセットデータベース内で、使用していないアセットバンドル名をすべて削除します。
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.
SaveAssetIfDirtyWrites all unsaved changes to the specified asset to disk.
SaveAssets保存されていないアセットの変更点をすべてディスクに書き出します。
SetImporterOverrideSets a specific importer to use for the asset.
SetLabelsアセットのラベルのリストを置き換えます。
SetMainObject次のインポート後にアセットファイル内のどのオブジェクトをメインオブジェクトにするかを指定します。
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

cacheServerConnectionChangedUnity raises this event when Cache Server connection is changed.
importPackageCancelledパッケージのインポートがユーザーによってキャンセルされるたびに発生するコールバック。
importPackageCompletedパッケージのインポートが成功するたびに発生するコールバック。
importPackageFailedパッケージのインポートが失敗するたびに発生するコールバック。
importPackageStartedパッケージのインポートが開始するたびに発生するコールバック。

デリゲート

ImportPackageCallback AssetDatabase.ImportPackage コールバックから呼び出されるデリゲート。packageName は、コールバックを発したパッケージの名前です。
ImportPackageFailedCallback AssetDatabase.ImportPackage コールバックから呼び出されるデリゲート。packageName は、コールバックを発したパッケージの名前です。errorMessage は失敗した理由です。