unity3d动态操作组件

利用范型,动态操作组件(添加或删除)

e.AddComponent<CubeTranslate> ();//动态添加组件
Destroy (e.GetComponent<CubeTranslate> ());//动态删除组件

其中e为动态生成的对象:

public  GameObject e;

 

posted on 2017-06-10 14:28  chenyangsocool  阅读(458)  评论(0编辑  收藏  举报