네트워크 멀티플레이 환경 문제 수정

관련 문제가 다시 발생하면 이 커밋으로 돌아올 것
This commit is contained in:
2026-02-02 04:24:14 +09:00
parent 3e747a9d97
commit 10b496dfae
49 changed files with 2860 additions and 1792 deletions

View File

@@ -0,0 +1,50 @@
using UnityEngine;
using UnityEngine.InputSystem;
using Unity.Netcode;
namespace Northbound
{
public class ShortcutNetworkStarter : MonoBehaviour
{
[Header("Input Actions")]
[SerializeField] private InputActionReference startAsClientAction;
private bool _isClientStarted = false;
private void Start()
{
if (startAsClientAction != null && startAsClientAction.action != null)
{
startAsClientAction.action.performed += StartAsClient;
}
}
private void OnDestroy()
{
if (startAsClientAction != null && startAsClientAction.action != null)
{
startAsClientAction.action.performed -= StartAsClient;
}
}
private void StartAsClient(InputAction.CallbackContext context)
{
if (NetworkManager.Singleton == null)
{
Debug.LogError("[ShortcutNetworkStarter] NetworkManager.Singleton이 null입니다!");
return;
}
if (NetworkManager.Singleton.IsClient)
{
Debug.Log("[ShortcutNetworkStarter] 이미 클라이언트 모드입니다.");
return;
}
_isClientStarted = true;
Debug.Log("[ShortcutNetworkStarter] 클라이언트 모드로 시작합니다...");
NetworkManager.Singleton.StartClient();
}
}
}