以下の内容はhttps://baba-s.hatenablog.com/entry/2022/09/09/090000より取得しました。


【Unity】Transform の Inspector のコンテキストメニューに「Copy Component」と「Paste Component Values」を表示するエディタ拡張

ソースコード

using UnityEditor;
using UnityEditorInternal;
using UnityEngine;

namespace Kogane.Internal
{
    internal static class TransformCopyComponentPasteComponentValues
    {
        [MenuItem( "CONTEXT/Transform/Copy Component" )]
        public static void CopyComponent( MenuCommand menuCommand )
        {
            var transform = ( Transform ) menuCommand.context;
            ComponentUtility.CopyComponent( transform );
        }

        [MenuItem( "CONTEXT/Transform/Paste Component Values" )]
        public static void PasteComponentValues( MenuCommand menuCommand )
        {
            var transform = ( Transform ) menuCommand.context;
            ComponentUtility.PasteComponentValues( transform );
        }
    }
}

使用例

現在の Unity では Transform の「Copy Component」と「Paste Component Values」が
コンテキストメニューの「Copy」「Paste」の中に隠されており、
選択するのに少し手間だったのでコンテキストメニューの最初の階層に
「Copy Component」と「Paste Component Values」を表示できるようにしました




以上の内容はhttps://baba-s.hatenablog.com/entry/2022/09/09/090000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14