Skip to content

Commit 770a693

Browse files
committed
Merge branch 'develop' into pdeschain/folder-assembly-refactor
2 parents 22ab650 + 5044c7f commit 770a693

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Assets/BossRoom/Scripts/Gameplay/Client/State/ClientMainMenuState.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ void OnSignInFailed()
109109
}
110110
}
111111

112+
public override void OnDestroy()
113+
{
114+
m_ProfileManager.onProfileChanged -= OnProfileChanged;
115+
base.OnDestroy();
116+
}
117+
112118
async void OnProfileChanged()
113119
{
114120
m_LobbyButton.interactable = false;

Packages/com.unity.multiplayer.samples.coop/Utilities/SceneManagement/ClientLoadingScreen.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using Unity.Netcode;
55
using UnityEngine;
6+
using UnityEngine.Assertions;
67
using UnityEngine.UI;
78

89
namespace Unity.Multiplayer.Samples.Utilities
@@ -65,6 +66,7 @@ public void UpdateProgress(float value, float newValue)
6566
void Awake()
6667
{
6768
DontDestroyOnLoad(this);
69+
Assert.AreEqual(m_OtherPlayersProgressBars.Count, m_OtherPlayerNamesTexts.Count, "There should be the same number of progress bars and name labels");
6870
}
6971

7072
void Start()
@@ -151,6 +153,12 @@ void ReinitializeProgressBars()
151153
RemoveOtherPlayerProgressBar(clientId);
152154
}
153155

156+
for (var i = 0; i < m_OtherPlayersProgressBars.Count; i++)
157+
{
158+
m_OtherPlayersProgressBars[i].gameObject.SetActive(false);
159+
m_OtherPlayerNamesTexts[i].gameObject.SetActive(false);
160+
}
161+
154162
var index = 0;
155163

156164
foreach (var progressTracker in m_LoadingProgressManager.ProgressTrackers)
@@ -166,12 +174,14 @@ void ReinitializeProgressBars()
166174
protected virtual void UpdateOtherPlayerProgressBar(ulong clientId, int progressBarIndex)
167175
{
168176
m_LoadingProgressBars[clientId].ProgressBar = m_OtherPlayersProgressBars[progressBarIndex];
177+
m_LoadingProgressBars[clientId].ProgressBar.gameObject.SetActive(true);
169178
m_LoadingProgressBars[clientId].NameText = m_OtherPlayerNamesTexts[progressBarIndex];
179+
m_LoadingProgressBars[clientId].NameText.gameObject.SetActive(true);
170180
}
171181

172182
protected virtual void AddOtherPlayerProgressBar(ulong clientId, NetworkedLoadingProgressTracker progressTracker)
173183
{
174-
if (m_LoadingProgressBars.Count < m_OtherPlayersProgressBars.Count)
184+
if (m_LoadingProgressBars.Count < m_OtherPlayersProgressBars.Count && m_LoadingProgressBars.Count < m_OtherPlayerNamesTexts.Count)
175185
{
176186
var index = m_LoadingProgressBars.Count;
177187
m_LoadingProgressBars[clientId] = new LoadingProgressBar(m_OtherPlayersProgressBars[index], m_OtherPlayerNamesTexts[index]);

0 commit comments

Comments
 (0)