Firstborn/Library/PackageCache/com.unity.inputsystem@1.5.1/InputSystem/Editor/Debugger/InputActionDebuggerWindow.cs
Schaken-Mods 9092858a58 updated to the latest editor
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
2023-05-07 17:43:11 -05:00

63 lines
1.9 KiB
C#

#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using UnityEditor;
////TODO: survive domain reload properly
namespace UnityEngine.InputSystem.Editor
{
internal class InputActionDebuggerWindow : EditorWindow
{
[NonSerialized] private InputAction m_Action = null;
public static void CreateOrShowExisting(InputAction action)
{
if (action == null)
throw new System.ArgumentNullException(nameof(action));
// See if we have an existing window for the action and if so pop it in front.
if (s_OpenDebuggerWindows != null)
{
for (var i = 0; i < s_OpenDebuggerWindows.Count; ++i)
{
var existingWindow = s_OpenDebuggerWindows[i];
if (ReferenceEquals(existingWindow.m_Action, action))
{
existingWindow.Show();
existingWindow.Focus();
return;
}
}
}
// No, so create a new one.
var window = CreateInstance<InputActionDebuggerWindow>();
window.Show();
window.titleContent = new GUIContent(action.name);
window.AddToList();
}
public void OnGUI()
{
}
private static List<InputActionDebuggerWindow> s_OpenDebuggerWindows;
private void AddToList()
{
if (s_OpenDebuggerWindows == null)
s_OpenDebuggerWindows = new List<InputActionDebuggerWindow>();
if (!s_OpenDebuggerWindows.Contains(this))
s_OpenDebuggerWindows.Add(this);
}
private void RemoveFromList()
{
if (s_OpenDebuggerWindows != null)
s_OpenDebuggerWindows.Remove(this);
}
}
}
#endif // UNITY_EDITOR