선택된 Uniy Editor 찾기 (EditorWindowDector)
Unity Engin에서 선택된(Focus) Editor를 찾는 간단한 기능의 코드이다.
활성화된 Editor가 변경될때마다 Console 로그로 나타낸다.
반응형
< Unity Editor Window 종류 >
< 코드 >
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
public class EditorWindowDector
{
private static EditorWindow lastActiveWindow;
static EditorWindowDector()
{
EditorApplication.update += OnEditorUpdate;
}
private static void OnEditorUpdate()
{
EditorWindow currentActiveWindow = EditorWindow.focusedWindow;
if (currentActiveWindow != lastActiveWindow)
{
lastActiveWindow = currentActiveWindow;
if (currentActiveWindow != null)
{
Debug.Log($"[Select EditorWindow] : <color=red>{currentActiveWindow.titleContent.text}</color>");
EditorGUIUtility.PingObject(currentActiveWindow);
}
}
}
}
Unity EditorWindow.focusedWindow : [링크]
Unity - Scripting API: EditorWindow.focusedWindow
Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close
docs.unity3d.com
★☆☆☆☆
반응형
'개발 > Unity' 카테고리의 다른 글
Unity) GUI Slider 간격 조절(1 -> 5단위 간격 조절) (0) | 2024.09.15 |
---|---|
Unity) 원형 룰렛(Roulette) 만들기 (2) | 2024.09.10 |
Unity) 값 변경시 Method 호출 (Attribute - Change Call) (3) | 2024.09.04 |
문제해결)Unity is running as administrator (0) | 2024.09.03 |
Unity) 숫자 롤링 애니메이션 (Number Rolling), 숫자 플립 애니메이션( Number Flip) (1) | 2024.08.28 |
댓글