コガネブログ

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

【Unity】【Odin Inspector 2.0 新機能】ValueDropdown 属性が拡張された

アセット

概要

using Sirenix.OdinInspector;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Example : MonoBehaviour
{
    [ValueDropdown( "GetAllChildObjects" )]
    public GameObject m_object;

    [ValueDropdown( "GetAllChildObjects", IsUniqueList = true )]
    public List<GameObject> m_list;

    private IEnumerable GetAllChildObjects()
    {
        for ( int i = 0; i < transform.childCount; i++ )
        {
            yield return transform.GetChild( i ).gameObject;
        }
    }
}

f:id:baba_s:20180814170106g:plain

「ValueDropdown」属性が拡張されて、よりカスタマイズしやすく使いやすくなりました

参考サイト様