38 lines
877 B
C#
38 lines
877 B
C#
|
using System;
|
||
|
using UnityEditor;
|
||
|
using UnityEngine;
|
||
|
|
||
|
[CustomEditor(typeof(CameraController))]
|
||
|
public class CameraControllerEditor : Editor
|
||
|
{
|
||
|
private CameraTypeEnum _selectedType;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
_selectedType = CameraTypeEnum.START;
|
||
|
}
|
||
|
|
||
|
public override void OnInspectorGUI()
|
||
|
{
|
||
|
base.OnInspectorGUI();
|
||
|
|
||
|
if (!Application.isPlaying)
|
||
|
return;
|
||
|
|
||
|
EditorGUILayout.Space();
|
||
|
EditorGUILayout.LabelField("Editor Tools", EditorStyles.boldLabel);
|
||
|
|
||
|
var camera = (CameraController)target;
|
||
|
_selectedType = camera.ActiveCamera.type;
|
||
|
var selected = (CameraTypeEnum)EditorGUILayout.EnumPopup("Active Camera: ", _selectedType);
|
||
|
|
||
|
EditorGUILayout.EndFoldoutHeaderGroup();
|
||
|
|
||
|
if (_selectedType != selected)
|
||
|
{
|
||
|
CameraManager.Activate(selected);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|