Unity Editor工具-代码里复制Component
//CopyComponent
ublic static T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = original.GetType(); Component copy = destination.AddComponent(type); System.Reflection.FieldInfo[] fields = type.GetFields(); foreach (System.Reflection.FieldInfo field in fields) { field.SetValue(copy, field.GetValue(original)); } return copy as T; }