Skip to content

Commit c79f451

Browse files
committed
Merge branch 'develop' into feature/auto-reconnect
2 parents d3ec2e2 + ff04a3c commit c79f451

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

Assets/BossRoom/Scenes/MainMenu.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:ab88f74282581bf8420dfd32062ed2908d6284179c47f46170c513b5de2c862a
3-
size 87040
2+
oid sha256:94ba7d5188c030aa53bd078d4044cc7c0deb9a542aac6f189e0f97b5a564a647
3+
size 90859

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using Unity.Services.Authentication;
88
using Unity.Services.Core;
99
using UnityEngine;
10-
10+
using UnityEngine.UI;
1111

1212
namespace Unity.Multiplayer.Samples.BossRoom.Client
1313
{
@@ -25,13 +25,12 @@ public class ClientMainMenuState : GameStateBehaviour
2525
[SerializeField] NameGenerationData m_NameGenerationData;
2626
[SerializeField] LobbyUIMediator m_LobbyUIMediator;
2727
[SerializeField] IPUIMediator m_IPUIMediator;
28-
29-
[SerializeField] CanvasGroup m_MainMenuButtonsCanvasGroup;
28+
[SerializeField] Button m_LobbyButton;
3029
[SerializeField] GameObject m_SignInSpinner;
3130

3231
protected override void Awake()
3332
{
34-
m_MainMenuButtonsCanvasGroup.interactable = false;
33+
m_LobbyButton.interactable = false;
3534
m_LobbyUIMediator.Hide();
3635
base.Awake();
3736
}
@@ -46,6 +45,15 @@ protected override void InitializeScope()
4645
[Inject]
4746
async void InjectDependenciesAndInitialize(AuthenticationServiceFacade authServiceFacade, LocalLobbyUser localUser, LocalLobby localLobby)
4847
{
48+
#if UNITY_EDITOR
49+
if (string.IsNullOrEmpty(UnityEditor.CloudProjectSettings.projectId))
50+
{
51+
PopupManager.ShowPopupPanel("Unity Game Services ProjectID not set up" ,"Please follow the steps outlined in Readme to set up your project id - it is required for the services to function.");
52+
OnSignInFailed();
53+
return;
54+
}
55+
#endif
56+
4957
try
5058
{
5159
var unityAuthenticationInitOptions = new InitializationOptions();
@@ -65,7 +73,7 @@ async void InjectDependenciesAndInitialize(AuthenticationServiceFacade authServi
6573

6674
void OnAuthSignIn()
6775
{
68-
m_MainMenuButtonsCanvasGroup.interactable = true;
76+
m_LobbyButton.interactable = true;
6977
m_SignInSpinner.SetActive(false);
7078

7179
Debug.Log($"Signed in. Unity Player ID {AuthenticationService.Instance.PlayerId}");
@@ -77,6 +85,7 @@ void OnAuthSignIn()
7785

7886
void OnSignInFailed()
7987
{
88+
m_LobbyButton.interactable = false;
8089
m_SignInSpinner.SetActive(false);
8190
}
8291
}

Assets/BossRoom/Scripts/Shared/Net/ConnectionManagement/GameNetPortal.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Unity.Netcode.Transports.UNET;
99
using Unity.Netcode.Transports.UTP;
1010
using Unity.Services.Authentication;
11+
using Unity.Services.Core;
1112
using UnityEngine;
1213
using UnityEngine.SceneManagement;
1314

@@ -262,6 +263,11 @@ public void RequestDisconnect()
262263

263264
public string GetPlayerId()
264265
{
266+
if (UnityServices.State != ServicesInitializationState.Initialized)
267+
{
268+
return ClientPrefs.GetGuid() + ProfileManager.Profile;
269+
}
270+
265271
return AuthenticationService.Instance.IsSignedIn ? AuthenticationService.Instance.PlayerId : ClientPrefs.GetGuid() + ProfileManager.Profile;
266272
}
267273
}

Assets/Readme.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:512ffb044e4ca1c4b125eea4266125dfe7c6c600bea20545afbe0ab3333350a5
3-
size 1634
2+
oid sha256:f829608f4fac5c3637e5daa00e20806530c3bf0420acfe14611195954e515f35
3+
size 1879

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ See [ART_NOTES.md](Documentation/ART_NOTES.md) for more information on the art o
2929

3030
This project uses Git Large Files Support (LFS), which ensures all large assets required locally are handled for the project. See [Git LFS installation options](https://github.com/git-lfs/git-lfs/wiki/Installation) for Windows and Mac instructions.
3131

32+
## Registering the project with Unity Gaming Services (UGS)
33+
34+
This project leverages several services from UGS to facilitate connectivity between players. In order to use these services inside your project, one must first [create an organization](https://support.unity.com/hc/en-us/articles/208592876-How-do-I-create-a-new-Organization-) inside Unity Dashboard, and enable both the [Relay](https://docs.unity.com/relay/get-started.html) and [Lobby](https://docs.unity.com/lobby/game-lobby-sample.html) services.
35+
3236
## Opening the project for the first time
3337

3438
Once you have downloaded the project, the steps below should get you up and running:

0 commit comments

Comments
 (0)