コガネブログ

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

【Unity】便利なエディタ拡張がたくさん使用できる「MyBox」紹介

はじめに

「MyBox」を Unity プロジェクトに導入することで
便利なエディタ拡張がたくさん使用できるようになります

使用例

ConditionalField

using UnityEngine;

public class Example : MonoBehaviour
{
    public bool m_enabled;

    [ConditionalField( "m_enabled" )]
    public float m_name;
}

f:id:baba_s:20181216162434g:plain

DefinedValues

using UnityEngine;

public class Example : MonoBehaviour
{
    [DefinedValues( 1, 3, 5 )]
    public int m_value;
}

f:id:baba_s:20181216162446p:plain

DisplayInspector

using UnityEngine;

[CreateAssetMenu]
public class Settings : ScriptableObject
{
    public int m_id;
    public string m_name;
}
using UnityEngine;

public class Example : MonoBehaviour
{
    [DisplayInspector]
    public Settings m_settings;
}

f:id:baba_s:20181216162452p:plain

Layer

using UnityEngine;

public class Example : MonoBehaviour
{
    [Layer]
    public int m_layer;
}

f:id:baba_s:20181216162457p:plain

MinMaxRange

using UnityEngine;

public class Example : MonoBehaviour
{
    [MinMaxRange( 80, 120 )]
    public RangedFloat m_value;
}

f:id:baba_s:20181216162504p:plain

ReadOnly

using UnityEngine;

public class Example : MonoBehaviour
{
    [ReadOnly]
    public float m_value;
}

f:id:baba_s:20181216162512p:plain

SearchableEnum

using UnityEngine;

public class Example : MonoBehaviour
{
    [SearchableEnum]
    public KeyCode m_keyCode;
}

f:id:baba_s:20181216162516p:plain

Separator

using UnityEngine;

public class Example : MonoBehaviour
{
    [Separator]
    public int m_id1;
    public string m_name1;

    [Separator]
    public int m_id2;
    public string m_name2;
}

f:id:baba_s:20181216162521p:plain

関連記事