コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】【NGUI】UIWrapContentのInspectorにソート用のボタンを追加するエディタ拡張

using UnityEditor;
using UnityEngine;

[CanEditMultipleObjects]
[CustomEditor( typeof( UIWrapContent ), true )]
public sealed class UIWrapContentEditorCustom : UIWrapContentEditor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if ( GUILayout.Button( "Sort Based on Scroll Movement" ) )
        {
            var self = target as UIWrapContent;
            self.SortBasedOnScrollMovement();
        }
        if ( GUILayout.Button( "Sort Alphabetically" ) )
        {
            var self = target as UIWrapContent;
            self.SortAlphabetically();
        }
    }
}

f:id:baba_s:20161016201341p:plain

関連記事