Unity Editor 深拷贝 组件
来源:互联网 发布:修改表数据的sql语句 编辑:程序博客网 时间:2024/06/08 19:10
Unity Editor 深拷贝 组件
GameObject Inspector 面板上 Copy Component 功能 的实现
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;using System;public class Copy : EditorWindow { static Component[] componentArr; [MenuItem("GameObject/Copy Component %#C")] static void CopyComponent() { componentArr = Selection.activeGameObject.GetComponents<Component>(); } [MenuItem("GameObject/Paste Component %#V")] static void PasteComponent() { if (componentArr == null) { return; } GameObject targetGameObject = Selection.activeGameObject; if (!targetGameObject) { return; } for (int i = 0; i < componentArr.Length; ++i) { Component component = componentArr[i]; if (!component) { continue; } UnityEditorInternal.ComponentUtility.CopyComponent(component); Type type = component.GetType(); Component componentOld = targetGameObject.GetComponent(type); if (!componentOld) { UnityEditorInternal.ComponentUtility.PasteComponentAsNew(targetGameObject); } else { UnityEditorInternal.ComponentUtility.PasteComponentValues(component); } } }}
阅读全文
0 0
- Unity Editor 深拷贝 组件
- Unity对象的所有组件深拷贝与粘贴
- Unity对象的所有组件深拷贝与粘贴
- 【Unity】Unity Editor Tips
- 【Unity 插件】 Shader Editor
- Unity学习 - Editor扩张
- Unity Editor编程杂记
- Unity Editor扩展
- Unity GUID替换Editor
- Unity Editor Scripting
- Unity Editor Scripting 2
- Unity Editor 常用类
- Unity Editor Window Zooming
- Unity Editor编译顺序
- Unity Editor编辑器(MenuItem)
- unity Editor 下批量导出Perfab ,更改模型shader,添加删除组件
- Unity Editor(二)C#特性与Editor
- [Editor]Unity Editor类常用方法
- Git 最佳实践:分支管理
- CTS Sensor Batching Test
- Nginx基础
- insert语句遇到字段名称为关键字
- 动手实现聊天机器人
- Unity Editor 深拷贝 组件
- Oracle练习1--初始化数据
- Android之build.prop imx6
- Mysql命令大全
- linux下weblogic安装并部署项目,图文详细
- ACM零起点2017-7-27(C++中string的基本用法)
- Checkpoint not complete解决办法
- 使用dotTrace6.0进行性能,内存分析
- firewall记录