CameraModule
- CameraManager
- Hierarchy의 Camera목록 관리.
- CameraTargetSelector
- Camera viewMode생성.
- 1인칭
- 3인칭 _ Back
- 3인칭 Top
- Camera viewMode별 함수 실행.
- 카메라 위치, 각도 지정.
- 타겟이 원하는 카메라 위치가 있을 때(eye) 변경가능.
- CameraInspectorDrawer
- CameraTargetSelector의 Inspector 변수 표시.
- Camera의 타겟 지정.
- Camera의 viewMode 선택.
- Camera viewMode에 따른 추가변수 입력.
- Inspector값을 EditMode의 Hierarckey에 적용.
--------------------------------------------------------------------------------
포인트
[CustomEditor(typeof(대상클래스)] 대상클래스.변수 = (필드타입) EditorGUILayout.FieldType( "필드명", 대상클래스.변수, 옵션 ) as 필드타입; 참조 : https://docs.unity3d.com/ScriptReference/EditorGUILayout.html
new EditorGUI.DisabledScope(bool 값);
참조 : https://docs.unity3d.com/ScriptReference/EditorGUI.DisabledScope.html
예시)
using UnityEngine; using UnityEditor; public class CInspectorDrawer : MonoBehaviour { [CustomEditor(typeof(CTargetSelector))] public class InspectorLocker : Editor { [HideInInspector] public bool first_P_View; override public void OnInspectorGUI() { var ctargetSelector = target as CTargetSelector; ctargetSelector.targetTransform = EditorGUILayout.ObjectField("TargetTransform", ctargetSelector.targetTransform, typeof(Transform)) as Transform; ctargetSelector.viewMode = (CTargetSelector.ViewMode)EditorGUILayout.EnumPopup("ViewMode", ctargetSelector.viewMode); if (ctargetSelector.viewMode == CTargetSelector.ViewMode.First_P) { first_P_View = true; } else { first_P_View = false; } using (new EditorGUI.DisabledScope(first_P_View)) //true면 비활성화. { //Debug.Log(first_P_View); ctargetSelector.distanceToTarget = EditorGUILayout.FloatField("DistanceToTarget", ctargetSelector.distanceToTarget); ctargetSelector.camerasHeight = EditorGUILayout.FloatField("CamerasHeight", ctargetSelector.camerasHeight); } ctargetSelector.EnableViewMode(ctargetSelector.viewMode); } } }
PS. Tistory 쓴 시간이 코딩에 걸린 시간보다 길다. (에라이<li> 들여쓰기 같으니라고...)
'GameDevelopmentDiary > Project_SomewhereSaga : 가제(맵 에디터에서 중지)' 카테고리의 다른 글
6,7일차 (0) | 2019.03.06 |
---|---|
5일차 (0) | 2019.03.01 |
4일차 (0) | 2019.02.24 |
3일차 (0) | 2019.02.23 |
2일차 (0) | 2019.02.20 |