含义:[RequireComponent(typeof())] 为游戏物体添加某组件
举例:脚本类名前,加[RequireComponent(typeof(Rigidbody))]
,脚本所在游戏物体,就会有Rigidbody
组件(即使场景不运行)
注意:无需引入UnityEditor命名空间
Unity编辑器 RequireComponent
猜你喜欢
转载自blog.csdn.net/weixin_42935398/article/details/124119968
今日推荐
周排行