오류수정

This commit is contained in:
2026-09-01 21:36:23 +09:00
parent 7ec587353a
commit 527dc54218
27 changed files with 922 additions and 80 deletions

View File

@@ -1,4 +1,6 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem.UI;
using UnityEngine.UI;
/// <summary>
@@ -9,6 +11,37 @@
/// </summary>
public static class ChatUiBuilder
{
/// <summary>
/// 씬에 EventSystem 이 없으면 만든다. 런타임 UI 를 쓰는 쪽은 모두 이걸 먼저 부른다.
///
/// Active Input Handling 이 신규 Input System 전용이므로 모듈은
/// InputSystemUIInputModule 이어야 한다. StandaloneInputModule 은 레거시
/// UnityEngine.Input 을 쓰기 때문에 이 설정에서 예외를 던진다.
/// </summary>
public static void EnsureEventSystem()
{
var existing = Object.FindFirstObjectByType<EventSystem>();
if (existing == null)
{
var go = new GameObject("EventSystem");
existing = go.AddComponent<EventSystem>();
var module = go.AddComponent<InputSystemUIInputModule>();
// 런타임에 붙이면 액션 에셋이 비어 있어 아무 입력도 받지 못한다.
if (module.actionsAsset == null) module.AssignDefaultActions();
}
// InputField 가 IME 상태를 물을 때 레거시 Input 으로 새지 않게 막는다.
// BaseInputModule 은 BaseInput 을 "상속한" 컴포넌트를 기본값으로 고르지 않으므로
// inputOverride 에 직접 넣어야 한다.
var baseModule = existing.GetComponent<BaseInputModule>();
if (baseModule != null && baseModule.inputOverride == null)
{
var safeInput = existing.GetComponent<SafeBaseInput>();
if (safeInput == null) safeInput = existing.gameObject.AddComponent<SafeBaseInput>();
baseModule.inputOverride = safeInput;
}
}
public static RectTransform NewRect(string name, Transform parent)
{
var go = new GameObject(name, typeof(RectTransform));

View File

@@ -72,7 +72,7 @@ public class ChatWindowUI : MonoBehaviour
void Awake()
{
EnsureEventSystem();
ChatUiBuilder.EnsureEventSystem();
Build();
panel.gameObject.SetActive(false);
}
@@ -336,37 +336,6 @@ IEnumerator ScrollToBottomNextFrame()
// ------------------------------------------------------------------ 계층 만들기
/// <summary>
/// 씬에 EventSystem 이 없으면 만든다.
///
/// Active Input Handling 이 신규 Input System 전용이므로 모듈은
/// InputSystemUIInputModule 이어야 한다. StandaloneInputModule 은 레거시
/// UnityEngine.Input 을 쓰기 때문에 이 설정에서 예외를 던진다.
/// </summary>
static void EnsureEventSystem()
{
var existing = FindFirstObjectByType<EventSystem>();
if (existing == null)
{
var go = new GameObject("EventSystem");
existing = go.AddComponent<EventSystem>();
var module = go.AddComponent<InputSystemUIInputModule>();
// 런타임에 붙이면 액션 에셋이 비어 있어 아무 입력도 받지 못한다.
if (module.actionsAsset == null) module.AssignDefaultActions();
}
// InputField 가 IME 상태를 물을 때 레거시 Input 으로 새지 않게 막는다.
// BaseInputModule 은 BaseInput 을 "상속한" 컴포넌트를 기본값으로 고르지 않으므로
// inputOverride 에 직접 넣어야 한다.
var baseModule = existing.GetComponent<BaseInputModule>();
if (baseModule != null && baseModule.inputOverride == null)
{
var safeInput = existing.GetComponent<SafeBaseInput>();
if (safeInput == null) safeInput = existing.gameObject.AddComponent<SafeBaseInput>();
baseModule.inputOverride = safeInput;
}
}
void Build()
{
var canvasGo = new GameObject("ChatCanvas", typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster));