找回密碼
 注冊帳號

掃一掃,訪問微社區

assetdatabase 資源數據庫

2014-12-31 22:36| 發布者: 楊炎| 查看: 2725| 評論: 0|原作者: 蠻牛|來自: unity3d腳本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下的資源包導入到當前工程。

相關閱讀

文章點評
相關文章
女校游泳队彩金