using UnityEngine;
using UnityEditor;
public class MyEditor : EditorWindow
{
private static EditorWindow window;
private static float width = 600;
private static float height = 600;
[MenuItem("CustomWindow/MyEditor")] //상단 메뉴에 추가됩니다.
public static void Open ()
{
window = GetWindow<MyEditor>();
Rect main = EditorGUIUtility.GetMainWindowPosition(); //전체 화면 크기를 갖고 옵니다.
window.minSize = window.maxSize = new Vector2(width, height); //시작 사이즈를 width, height로 만들어 주고
window.minSize = new Vector2(200, 200);
window.maxSize = new Vector2(main.width, main.height); //제한을 풀어줍니다.
//window.position에 x, y 좌표와 width, height가 들어있습니다.
window.position = new Rect((main.width - width) * 0.5f, (main.height - height) * 0.5f, width, height);
}
private void OnGUI()
{
GUILayout.Label("Hello!");
}
}


유니티 에디터에 대해 독학 중인데 엄청난 뻘짓들을 하고 있습니다..
가끔씩 이상한데 꽂혀서 시간을 많이 쓰네요.. ㅠ_ㅠ
찾아보면 기능들이 다양하고 많네요 ' - '@
시간이 되면 만져 본 것들을 하나씩 정리해보기!
'Unity > 유니티 에디터 (Unity Editor)' 카테고리의 다른 글
[Unity Editor] 유니티 스크립터블 오브젝트 (ScriptableObject) (0) | 2022.03.24 |
---|---|
[Unity Editor] 확인, 취소 메시지 띄우기 EditorUtility.DisplayDialog (0) | 2022.03.23 |
[유니티 에디터] ScriptableObject and OnInspectorGUI Show Image (Sprite, Texture) (0) | 2021.09.26 |