Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
AssetPostprocessor.OnPostprocessModel 在导入模型之后
# [AssetPostprocessor](AssetPostprocessor.html).OnPostprocessModel 在导入模型之后 function *OnPostprocessModel* (root : [GameObject](../GameObject/GameObject.html)) : 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); } } ```
da
2022年5月14日 13:10
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码