11
8

More than 5 years have passed since last update.

【Unity5】変数の値をSceneビュー上にInspector風に表示させるエディター拡張

Last updated at Posted at 2016-05-12

※この記事のUnityのバージョンは5.3.2p4です

image

はじめに

KLabGames Tech Blog - Unity なんでもインスペクタに表示していくやつ

上記ページのエディター拡張が素晴らしかったので、これを参考にSceneビュー上で変数が確認できるよう
にするエディター拡張を作ってみました.

サンプルプロジェクト

ソースコード

以下のスクリプトをプロジェクトに配置すればOK
DebuggingSceneWindow.cs

使い方

下記のように[Inspectable]を記述するとウィンドウに変数とその中身が表示されます.

TestComponent.cs
using UnityEngine;
using System.Collections;

[Inspectable]
public class TestComponent : MonoBehaviour
{
  [Inspectable]
  int x = 100;

  [Inspectable]
  Vector2 vector2;

  [Inspectable]
  Vector3 Position { get { return this.transform.position; } }
}

image

参考

KLabGames Tech Blog - Unity なんでもインスペクタに表示していくやつ
http://klabgames.tech.blog.jp.klab.com/archives/1047665593.html

11
8
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
11
8