浏览代码

Added Warnings to UI Event Manager editor

/feature-new-input-system
Thomas ICHÉ 3 年前
当前提交
bad93f0f
共有 3 个文件被更改,包括 65 次插入1 次删除
  1. 1
      Runtime/LevelScripting/Events/OnInputDirectEvent.cs
  2. 54
      Editor/CustomInspectors/UIEventManagerEditor.cs
  3. 11
      Editor/CustomInspectors/UIEventManagerEditor.cs.meta

1
Runtime/LevelScripting/Events/OnInputDirectEvent.cs


throw new System.NotImplementedException();
}
}
#endif

54
Editor/CustomInspectors/UIEventManagerEditor.cs


using UnityEngine;
using UnityEditor;
namespace GameplayIngredients.Editor
{
[CustomEditor(typeof(UIEventManager), true)]
public class UIEventManagerEditor : ManagerEditor
{
public override void OnInspectorGUI_PingArea()
{
base.OnInspectorGUI_PingArea();
#if ENABLE_INPUT_SYSTEM
if(!(serializedObject.targetObject as UIEventManager).gameObject.TryGetComponent(out UnityEngine.InputSystem.UI.InputSystemUIInputModule issim))
{
using(new EditorGUI.IndentLevelScope(1))
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Bad Configuration : New Input System Standalone Input", EditorStyles.boldLabel);
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.HelpBox("You are using the new Input System, but the current game object is missing a InputSystemUIInputModule", MessageType.Warning);
if (GUILayout.Button("Fix", GUILayout.ExpandHeight(true), GUILayout.Width(80)))
{
(serializedObject.targetObject as UIEventManager).gameObject.AddComponent<UnityEngine.InputSystem.UI.InputSystemUIInputModule>();
}
}
}
}
#endif
#if !ENABLE_LEGACY_INPUT_MANAGER
if ((serializedObject.targetObject as UIEventManager).gameObject.TryGetComponent(out UnityEngine.EventSystems.StandaloneInputModule sim))
{
using (new EditorGUI.IndentLevelScope(1))
{
EditorGUILayout.Space();
EditorGUILayout.LabelField("Bad Configuration : Legacy Input System", EditorStyles.boldLabel);
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.HelpBox("You are not using the Legacy Input System, but the current game object is hosting a StandaloneInputModule", MessageType.Warning);
if (GUILayout.Button("Remove", GUILayout.ExpandHeight(true), GUILayout.Width(80)))
{
DestroyImmediate((serializedObject.targetObject as UIEventManager).gameObject.GetComponent<UnityEngine.EventSystems.StandaloneInputModule>());
}
}
}
}
#endif
}
static readonly Color color = new Color(.8f, .6f, .1f, 1f);
}
}

11
Editor/CustomInspectors/UIEventManagerEditor.cs.meta


fileFormatVersion: 2
guid: ae3d7937d49de9d43ac7d52cc9728c22
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存