Unity 经典教程 Editor扩展之AddComponentMenu

2025-06-15 15:53:13

Unity 经典教程 Editor扩展之AddComponentMenu的使用。主要介绍使用AddComponentMenu对于选择的物体进行添加脚本操作,本节简单通过使用AddComponentMenu设计一个实现删除选中物体的案例,具体如下:

Unity 经典教程 Editor扩展之AddComponentMenu

2、在工程里面新建一个脚本,可以命名为“AddComponentMenuTest”,如下图

Unity 经典教程 Editor扩展之AddComponentMenu

3、选择中新建的脚本“AddComponentMenuTest”,双击脚本或者右键“Open C# Project”,打开脚本,如下图

Unity 经典教程 Editor扩展之AddComponentMenu

5、编译正确后,回到Unity界面,在场景里面添加一个“GameObject”,如下图

Unity 经典教程 Editor扩展之AddComponentMenuUnity 经典教程 Editor扩展之AddComponentMenu

7、到此,《Unity 经典教程 Editor扩展之AddComponentMenu的使用》讲解结束,更多资料可参见 Unity Manul 手册,谢谢

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢