assetpostprocessor.onpostprocessmodel 在导入模型之后

2015-1-1 06:56| 发布者: 杨炎| 查看: 1743| 评论: 0|原作者: 蛮牛|来自: yzc88亚洲城脚本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);

}

}

相关阅读

文章点评
相关文章