找回密碼
 注冊帳號

掃一掃,訪問微社區

assetpostprocessor.onpostprocessmodel 在導入模型之后

2015-1-1 09:40| 發布者: 楊炎| 查看: 2251| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: assetpostprocessor.onpostprocessmodel 在導入模型之后functiononpostprocessmodel(root :gameobject) : voiddescription描述add this function in a subclass to get a notification when a model has completed i ...

assetpostprocessor.onpostprocessmodel 在導入模型之后

functiononpostprocessmodel(root :object" target="_blank" class="relatedlink">gameobject) : void

description描述

add this function in a subclass to get a notification when a model has completed importing

在子類中加入這個函數,以便在模型載入之后獲得一個通知。

just before a prefab is generated out of the game object hierarchy root is the root game object of the imported model.

游戲物體脫離根層級之前生成一個預設,層次根是被導入的模型的根物體。

class mymodelpostprocessor extends assetpostprocessor {

function onpostprocessmodel (g :gameobject) {

apply(g.transform);

}

// add a mesh collider to each game object that contains collider in its name

// 根據名字添加一個mesh碰撞器在各個游戲物體上

function apply (transform :transform)

{

if (transform.name.tolower().contains("collider"))

{

transform.gameobject.addcomponent(meshcollider);

}

// recurse

// 循環

for (var child in transform)

apply(child);

}

}

相關閱讀

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