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


【Unity】Preset の Excluded Properties を昇順に並べ替えるエディタ拡張

概要

Preset を右クリックして「Exclude all properties」を押すと
プロパティが除外設定に登録されるが順番に規則性がないため
除外設定を解除したいプロパティを探すのが大変だった

using System.Linq;
using UnityEditor;
using UnityEditor.Presets;

public static class PresetMenuItem
{
    [MenuItem( "CONTEXT/Preset/Excluded Properties を昇順に並べ替え" )]
    private static void SortExcludedProperties( MenuCommand menuCommand )
    {
        var preset = ( Preset ) menuCommand.context;

        Undo.RecordObject( preset, "Excluded Properties を昇順に並べ替え" );

        preset.excludedProperties = preset.excludedProperties
                .OrderBy( x => x )
                .ToArray()
            ;

        // Array.Sort では反映されない
        //Array.Sort( preset.excludedProperties );
    }
}

上記のエディタ拡張を使用すると

除外設定に登録されたプロパティが名前順にソートされるので
除外設定を解除したいプロパティを探しやすくなる




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

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