assetdatabase 资源数据库

2014-12-31 22:36| 发布者: 杨炎| 查看: 2588| 评论: 0|原作者: 蛮牛|来自: yzc88亚洲城脚本manual

摘要: assetdatabase 资源数据库an interface for accessing assets and performing operations on assets.assetdatabase是一个对资源进行读写和各种操作的接口。note: this is an editor class. to use it you have to pl ...

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

is object an asset? // 资源中是否存在该对象?

createfolder

create a new folder. // 创建一个新的文件夹。

ismainasset

is asset a main asset in the project window?

该资源在project窗口中是不是主资源?

generateuniqueassetpath

creates a new unique path for an asset.

给一个资源创建一个新的唯一路径。

startassetediting

begin asset importing. this lets you group several asset imports together into one larger import.

开始资源导入。它可以让你把多个资源导入组合成一个更大的导入。

stopassetediting

stop asset importing. this lets you group several asset imports together into one larger import.

停止资源导入。这可以让你把多个资源导入组合成一个更大的导入。

validatemoveasset

checks if an asset file can be moved from one folder to another. (without actually moving the file)

检查一个资源文件是否可以从一个文件夹移动到另外一个。(并不是真的移动这个文件)

moveasset

move an asset file from one folder to another.

将一个资源文件从一个文件夹移动到另外一个文件夹。

renameasset

rename an asset file. // 重命名资源文件。

moveassettotrash

moves the asset at path to the trash.

将指定路径的资源移动到回收站。

deleteasset

deletes the asset file at path.

删除指定路径的资源文件。

importasset

import asset at path.

导入指定路径的资源。

copyasset

duplicates the asset at path and stores it at newpath

复制指定路径的资源文件到一个新的路径。

createasset

creates a new asset at path.

在指定的路径新建资源。

addobjecttoasset

adds objecttoadd to an existing asset at path.

将objecttoadd这个对象添加到指定路径上的现有资源。

getassetpath

returns the path name relative to the project folder where the asset is stored

返回相对于工程资源位置的路径名。

gettextmetadatapathfroma...

gets the path to the text .meta file associasted with an asset

获取资源有关文本.meta文件的路径。

loadassetatpath

returns the first asset object of type type at given path assetpath.

返回在指定位置assetpath下第一个类型是type的资源对象。

loadmainassetatpath

returns the main asset object at assetpath.

返回指定路径assetpath下的主资源。

loadallassetrepresentations...

returns all asset representations at assetpath.

返回assetpath所在路径的所有资源说明。

loadallassetsatpath

returns an array of all asset objects at assetpath.

返回指定路径assetpath下的所有资源对象数组。

refresh

import any changed assets.

重新导入有更新的资源。

openasset

opens the asset with associated application.

用关联的程序打开资源文件。

assetpathtoguid

get the guid for the asset at path

返回指定路径path下资源的guid(全局唯一标识符)。

guidtoassetpath

translate a guid to its current asset path

将guid(全局唯一标识符)转换为对应的资源路径。

saveassets

writes all unsaved asset changes to disk.

将所有未保存的资源更改写入磁盘。

getcachedicon

retrieves an icon for the asset at the given asset path.

为指定路径的资源检索一个图标。

completelabel

returns all labels that match the given prefix.

返回符合给定前缀的所有标签。

setlabels

replaces that list of labels on an asset.

替换资源的标签列表。

getlabels

returns all labels attached to a given asset.

返回给定资源拥有的所有标签。

clearlabels

removes all labels attached to an asset.

移除资源上所有的标签。

getdependencies

given an asset pathname, returns the list of all assets it depends on.

已知资源pathname,返回与它有依赖关系的所有资源列表。

exportpackage

exports the assets identified by assetpathnames to a unitypackage file in filename.

导出assetpahtnames定义的资源到一个unitypackage里,并命名filename。

importpackage

imports package at packagepath into the current project.

将packagepath下的资源包导入到当前工程。

相关阅读

文章点评
相关文章