[Editor] EditorGUI Foldout
Unity3D 2013. 9. 1. 00:44http://docs.unity3d.com/Documentation/ScriptReference/EditorGUI.Foldout.html
using UnityEngine;
using System.Collections;
using UnityEditor;
public class TestEditor : EditorWindow {
private bool _showPosition = true;
private string _status = "test";
[MenuItem("Test/AnimationChecker")]
static void Init(){
EditorWindow window = EditorWindow.GetWindow(typeof(TestEditor));
// window.position = new Rect(0, 0, 150, 60);
window.Show();
}
void OnGUI(){
this._showPosition = EditorGUI.Foldout(new Rect(3,3,this.position.width-6, 15),
this._showPosition, this._status);
if (this._showPosition)
if( Selection.activeTransform){
Selection.activeTransform.position
= EditorGUI.Vector3Field(new Rect(3, 25, position.width-6, 40),
"Position",
Selection.activeTransform.position);
this._status = Selection.activeTransform.name;
}
if( !Selection.activeTransform) {
this._status = "Select a GameObject";
this._showPosition = false;
}
GUILayout.BeginArea(new Rect(0, 100, position.width, 100));
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField(this._showPosition.ToString());
EditorGUILayout.LabelField(Selection.activeTransform.ToString());
EditorGUILayout.EndVertical();
GUILayout.EndArea();
}//OnGUI
void OnInspectorUpdate(){
this.Repaint();
}
}
'Unity3D' 카테고리의 다른 글
Bringing some depth for your 2D Game Design - Isometric and Dimetric perspective techniques (0) | 2013.09.03 |
---|---|
Smoothmoves 플러그인 사용시 유니티 버전 4.2에서 생겨나는 문제점 (0) | 2013.09.02 |
(스크랩) 게임 오브젝트 활성화/비활성화시 참고할 사항들 (0) | 2013.08.25 |
What's the difference between Update and FixedUpdate? When are they called? (0) | 2013.08.23 |
Layermak (0) | 2013.08.13 |