0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Unityのエディタ拡張

Posted at

メニュー追加

static関数にMenuItemアトリビュートを追加

OpenMenu.cs
using UnityEditor;

public class Menu
{
    [MenuItem("Menu/Do Something")]
    static void DoSomething()
    {
        // Do Something.
    }
}

create追加

ScriptableObjectを継承したクラスにCreateAssetMenuアトリビュートを追加

CreateAsset.cs
using UnityEngine;

[CreateAssetMenu("HogeAsset")]
public class HogeAsset : ScriptableObject
{
}

settings追加

SettingsProviderを継承したクラスを作成

Settings.cs
using UnityEditor;

public class Settings : SettingsProvider
{
}

Inspector表示変更

Editorを継承したクラスを作成し、CustomEditorアトリビュートを追加

HogeBehaviourEditor.cs
using UnityEngine;
using UnityEditor;

public class HogeBehaviour : MonoBehaviour
{
}

// TODO : you should separate HogeBehaviourEditor in other file!!
[CustomEditor(typeof(HogeBehaviour))]
public class HogeBehaviourEditor : Editor
{
    public override void OnInspectorGUI()
    {
    }
}

エディタショートカット

Edit > Shortcutsからショートカットキーが割り当てられる。
よく使うコマンドはショートカットキーを割り当てることをおススメ!
2回押しコマンド(Ctrl+x Ctrl+s とか)はできない
同時押しにしか対応していなくてちょっと残念

エディタウィンドウビュー

GraphViewやUIElementsを使ってみましょう。
GraphViewはBlueprintのような洗練されたノードベースの作成ができるのでおススメ。
UIElementsはcssやxmlを使うことで設定やレイアウトの使いまわしが効く。
IMGUIとも互換性があるので使いやすい。
ただし、再生中のUI表示にはまだ対応していないので注意!

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?