概要
using UnityEditor; using UnityEditorInternal; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var gameObject = Selection.activeGameObject; ComponentUtility.PasteComponentAsNew( gameObject ); } }
ComponentUtility.PasteComponentAsNew
を使用する