2using System.Collections;
15 public const string GUID =
"RuntimeUnityEditor";
31 if (_showHotkey != value)
57 internal static MonoBehaviour PluginObject {
get;
private set; }
58 internal static ILoggerWrapper Logger {
get;
private set; }
63 private CursorLockMode _previousCursorLockState;
64 private bool _previousCursorVisible;
65 private KeyCode _showHotkey = KeyCode.F9;
67 internal RuntimeUnityEditorCore(MonoBehaviour pluginObject, ILoggerWrapper logger,
string configPath)
70 throw new InvalidOperationException(
"Can only create one instance of the Core object");
72 PluginObject = pluginObject;
81 for (var i = 0; i < items.Length; i++)
83 var stackEntry = items[i];
88 if (UnityFeatureHelper.SupportsVectrosity)
91 TreeViewer.TreeSelectionChangedCallback = transform => _gizmoDrawer.UpdateState(transform);
99 var originalSkin = GUI.skin;
100 GUI.skin = InterfaceMaker.CustomSkin;
102 Cursor.lockState = CursorLockMode.None;
103 Cursor.visible =
true;
109 GUI.skin = originalSkin;
126 _previousCursorLockState = Cursor.lockState;
127 _previousCursorVisible = Cursor.visible;
131 if (!_previousCursorVisible || _previousCursorLockState != CursorLockMode.None)
133 Cursor.lockState = _previousCursorLockState;
134 Cursor.visible = _previousCursorVisible;
141 if (_gizmoDrawer !=
null)
143 _gizmoDrawer.Show = value;
151 RefreshGameObjectSearcher(
true);
156 internal void Update()
163 RefreshGameObjectSearcher(
false);
165 Cursor.lockState = CursorLockMode.None;
166 Cursor.visible =
true;
170 internal void LateUpdate()
174 Cursor.lockState = CursorLockMode.None;
175 Cursor.visible =
true;
179 private void RefreshGameObjectSearcher(
bool full)
181 var gizmosExist = _gizmoDrawer !=
null && _gizmoDrawer.Lines.Count > 0;
182 _gameObjectSearcher.Refresh(full, gizmosExist ? GizmoFilter : (Predicate<GameObject>)
null);
185 private bool GizmoFilter(GameObject o)
190 private void SetWindowSizes()
192 const int screenOffset = 10;
194 var screenRect =
new Rect(
197 Screen.width - screenOffset * 2,
198 Screen.height - screenOffset * 2);
200 var centerWidth = (int)Mathf.Min(850, screenRect.width);
201 var centerX = (int)(screenRect.xMin + screenRect.width / 2 - Mathf.RoundToInt((
float)centerWidth / 2));
203 var inspectorHeight = (int)(screenRect.height / 4) * 3;
210 var rightWidth = 350;
211 var treeViewHeight = screenRect.height;
213 screenRect.xMax - rightWidth,
const string GizmoObjectName
Keeps track of root gameobjects and allows searching objects in the scene
void UpdateWindowSize(Rect windowRect)
Transform SelectedTransform
void SelectAndShowObject(Transform target)
EventHandler SettingsChanged
Inspector.Inspector Inspector
ObjectTreeViewer TreeViewer