Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
AssetDatabase 资源数据库
# AssetDatabase 资源数据库 An Interface for accessing assets and performing operations on assets. 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. 注意:这是一个编辑器类,如果想使用它你需要把它放到工程目录下的 Assets/Editor 文件夹下。编辑器类在 UnityEditor 命名空间下。所以当使用 C#脚本时,你需要在脚本前面加上 "using UnityEditor"引用。 ### Class Functions**类函数** * [Contains](AssetDatabase.Contains.html) Is object an asset? 资源中是否存在该对象? * [IsMainAsset](AssetDatabase.IsMainAsset.html) Is asset a main asset in the project window? 该资源在 Project 窗口中是不是主资源? * [GenerateUniqueAssetPath](AssetDatabase.GenerateUniqueAssetPath.html) Creates a new unique path for an asset. 给一个资源创建一个新的唯一路径。 * [StartAssetEditing](AssetDatabase.StartAssetEditing.html) Begin Asset importing. This lets you group several asset imports together into one larger import. 开始资源导入。它可以让你把多个资源导入组合成一个更大的导入。 * [StopAssetEditing](AssetDatabase.StopAssetEditing.html) Stop Asset importing. This lets you group several asset imports together into one larger import. 停止资源导入。这可以让你把多个资源导入组合成一个更大的导入。 * [ValidateMoveAsset](AssetDatabase.ValidateMoveAsset.html) Checks if an asset file can be moved from one folder to another. (Without actually moving the file) 检查一个资源文件是否可以从一个文件夹移动到另外一个。(并不是真的移动这个文件) * [MoveAsset](AssetDatabase.MoveAsset.html) Move an asset file from one folder to another. 将一个资源文件从一个文件夹移动到另外一个文件夹。 * [RenameAsset](AssetDatabase.RenameAsset.html) Rename an asset file. 重命名资源文件。 * [MoveAssetToTrash](AssetDatabase.MoveAssetToTrash.html) Moves the asset at path to the trash. 将指定路径的资源移动到回收站。 * [DeleteAsset](AssetDatabase.DeleteAsset.html) Deletes the asset file at path. 删除指定路径的资源文件。 * [ImportAsset](AssetDatabase.ImportAsset.html) Import asset at path. 导入指定路径的资源。 * [CopyAsset](AssetDatabase.CopyAsset.html) Duplicates the asset at path and stores it at newPath 复制指定路径的资源文件到一个新的路径。 * [CreateAsset](AssetDatabase.CreateAsset.html) Creates a new asset at path. 在指定的路径新建资源。 * [AddObjectToAsset](AssetDatabase.AddObjectToAsset.html) Adds objectToAdd to an existing asset at path. 将 objectToAdd 这个对象添加到指定路径上的现有资源。 * [GetAssetPath](AssetDatabase.GetAssetPath.html) Returns the path name relative to the project folder where the asset is stored 返回相对于工程资源位置的路径名。 * [LoadAssetAtPath](AssetDatabase.LoadAssetAtPath.html) Returns the first asset object of type type at given path assetPath. 返回在指定位置 assetPath 下第一个类型是 type 的资源对象。 * [LoadMainAssetAtPath](AssetDatabase.LoadMainAssetAtPath.html) Returns the main asset object at assetPath. 返回指定路径 assetPath 下的主资源。 * [LoadAllAssetsAtPath](AssetDatabase.LoadAllAssetsAtPath.html) Returns an array of all asset objects at assetPath. 返回指定路径 assetPath 下的所有资源对象数组。 * [Refresh](AssetDatabase.Refresh.html) Import any changed assets. 重新导入有更新的资源。 * [OpenAsset](AssetDatabase.OpenAsset.html) Opens the asset with associated application. 用关联的程序打开资源文件。 * [AssetPathToGUID](AssetDatabase.AssetPathToGUID.html) Get the GUID for the asset at path 返回指定路径 path 下资源的 GUID(全局唯一标识符)。 * [GUIDToAssetPath](AssetDatabase.GUIDToAssetPath.html) Translate a GUID to its current asset path 将 GUID(全局唯一标识符)转换为对应的资源路径。 * [SaveAssets](AssetDatabase.SaveAssets.html) Writes all unsaved asset changes to disk. 将所有未保存的资源更改写入磁盘。 * [GetCachedIcon](AssetDatabase.GetCachedIcon.html) Retrieves an icon for the asset at the given asset path. 为指定路径的资源检索一个图标。 * [CompleteLabel](AssetDatabase.CompleteLabel.html) Returns all labels that match the given prefix. 返回符合给定前缀的所有标签。 * [SetLabels](AssetDatabase.SetLabels.html) Replaces that list of labels on an asset. 替换资源的标签列表。 * [GetLabels](AssetDatabase.GetLabels.html) Returns all labels attached to a given asset. 返回给定资源拥有的所有标签。 * [ClearLabels](AssetDatabase.ClearLabels.html) Removes all labels attached to an asset. 移除资源上所有的标签。 * [GetDependencies](AssetDatabase.GetDependencies.html) Given an asset pathName, returns the list of all assets it depends on. 已知资源 pathName,返回与它有依赖关系的所有资源列表。 * [ExportPackage](AssetDatabase.ExportPackage.html) Exports the assets identified by assetPathNames to a unitypackage file in fileName. 导出 assetPahtNames 定义的资源到一个 unitypackage 里,并命名 filename。 * [ImportPackage](AssetDatabase.ImportPackage.html) Imports package at packagePath into the current project. 将 packagePath 下的资源包导入到当前工程。
da
2022年5月14日 12:57
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码