해당 문제에 대해 해결은 내가 했다. 해당 일이 발생한 이유는 3D 랜더링 파이프라인을 한 번이라도 적용시켰던 나에게서 원인이 있을 가능성이 컸기 때문이다.
해당 문제를 해결한 방법은 다음과 같았다.
해갈 방법 자체는 간단했지만 생각지도 못한 것이었다.
혹시나를 생각해 남겨두었던 3D 오브젝트 랜더링 파이프라인 파일을 아예 삭제하니까 해당 문제가 해결되었다.
이런 문제가 발생한 이유 첫 번째는, RPC가 연결되어 있지 않았다는 부분이었다. 해당 부분은 내가 직접 연결하였다.
private void CheckRematchVotes()
{
if (!PhotonNetwork.IsMasterClient) return;
bool allVoted = true;
bool allAgree = true;
foreach (var kvp in rematchVotes)
{
if (!kvp.Value)
{
allAgree = false;
// 추가한 부분
photonView.RPC("RPC_RematchDeclined", RpcTarget.All);
break;
}
}
if (allAgree)
{
// 모든 플레이어가 리매치에 동의
photonView.RPC("RPC_RematchAccepted", RpcTarget.All);
}
}
해당 문제는 결과적으로는 논리 문제라는 것을 알게 되었다.
처음에 짜여 있는 로직 자체는 이런 느낌이었다.
private void Awake()
{
yesButton.onClick.AddListener(() => VoteRematch(true));
noButton.onClick.AddListener(() => VoteRematch(false));
gameObject.SetActive(false);
}
private void OnEnable()
{
InGameManager.OnRematchRequest += OnRematchResult;
ResetButtonStates();
}
private void OnDisable()
{
InGameManager.OnRematchRequest -= OnRematchResult;
}
/// <summary>
/// 리매치 투표
/// </summary>
private void VoteRematch(bool vote)
{
if (InGameManager.Instance != null)
{
InGameManager.Instance.VoteRematch(vote);
yesButton.interactable = false;
noButton.interactable = false;
waitingText.text =
vote ? "Try Rematch, waiting for opponent decision..." : "Quit Game, waiting for opponent decision...";
}
}
/// <summary>
/// InGameManager에서 전달하는 리매치 결과 처리
/// </summary>
private void OnRematchResult(bool accepted)
{
if (accepted)
{
Debug.Log("리매치 승인");
gameObject.SetActive(false);
SceneManager.LoadScene("TempLoadingScene");
}
else
{
Debug.Log("리매치 거부됨");
EndGame();
}
}
private void EndGame()
{
if (isLeaving) return;
isLeaving = true;
Debug.Log("방에나감.");
PhotonNetwork.LeaveRoom();
}
public override void OnLeftRoom()
{
Debug.Log("씬 전환");
SceneManager.LoadScene("USW/LobbyScene/LobbyScene");
SoundManager.Instance.PlayBGMLoop("MainMenuLoop");
}
하지만 이와 같은 방법이 적용되지 않는 이유는, 해당 UI 자체가 LeaveRoom을 하는 순간 유지되지 않기 때문에 OnLeftRoom이 아예 호출되지 않는 문제였다.
따라서, 씬과 사운드를 전환한 다음에 LeaveRoom()을 하는 편이 자연스럽다.
private void Awake()
{
yesButton.onClick.AddListener(() => VoteRematch(true));
noButton.onClick.AddListener(() => VoteRematch(false));
gameObject.SetActive(false);
}
private void OnEnable()
{
InGameManager.OnRematchRequest += OnRematchResult;
ResetButtonStates();
}
private void OnDisable()
{
InGameManager.OnRematchRequest -= OnRematchResult;
}
/// <summary>
/// 리매치 투표
/// </summary>
private void VoteRematch(bool vote)
{
if (InGameManager.Instance != null)
{
InGameManager.Instance.VoteRematch(vote);
yesButton.interactable = false;
noButton.interactable = false;
waitingText.text =
vote ? "Try Rematch, waiting for opponent decision..." : "Quit Game, waiting for opponent decision...";
}
}
/// <summary>
/// InGameManager에서 전달하는 리매치 결과 처리
/// </summary>
private void OnRematchResult(bool accepted)
{
if (accepted)
{
Debug.Log("리매치 승인");
gameObject.SetActive(false);
SceneManager.LoadScene("TempLoadingScene");
}
else
{
Debug.Log("리매치 거부됨");
EndGame();
}
}
private void EndGame()
{
if (isLeaving) return;
isLeaving = true;
Debug.Log("방에나감.");
SceneManager.LoadScene("USW/LobbyScene/LobbyScene");
SoundManager.Instance.PlayBGMLoop("MainMenuLoop");
PhotonNetwork.LeaveRoom();
}
public override void OnLeftRoom()
{
Debug.Log("씬 전환");
}