Skip to content

Commit c885305

Browse files
fix: can click through loading screen [MTT-4753] (#760)
* Adding graphic raycaster to loading screen and turning on/off raycast blocking
1 parent 6829370 commit c885305

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

Assets/Prefabs/UI/LoadingScreen.prefab

+19-1
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ GameObject:
462462
- component: {fileID: 5535057700358825828}
463463
- component: {fileID: 5841466599347033389}
464464
- component: {fileID: 3127630062634103998}
465+
- component: {fileID: 2516136186326398479}
465466
m_Layer: 5
466467
m_Name: LoadingScreen
467468
m_TagString: Untagged
@@ -543,7 +544,7 @@ CanvasGroup:
543544
m_PrefabAsset: {fileID: 0}
544545
m_GameObject: {fileID: 948382310089859896}
545546
m_Enabled: 1
546-
m_Alpha: 1
547+
m_Alpha: 0
547548
m_Interactable: 0
548549
m_BlocksRaycasts: 0
549550
m_IgnoreParentGroups: 0
@@ -582,6 +583,23 @@ MonoBehaviour:
582583
- {fileID: 6817560313460574097}
583584
m_LoadingProgressManager: {fileID: 0}
584585
m_PersistentPlayerRuntimeCollection: {fileID: 11400000, guid: 23c3465e22da67c4e812c4faf3adb1cb, type: 2}
586+
--- !u!114 &2516136186326398479
587+
MonoBehaviour:
588+
m_ObjectHideFlags: 0
589+
m_CorrespondingSourceObject: {fileID: 0}
590+
m_PrefabInstance: {fileID: 0}
591+
m_PrefabAsset: {fileID: 0}
592+
m_GameObject: {fileID: 948382310089859896}
593+
m_Enabled: 1
594+
m_EditorHideFlags: 0
595+
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
596+
m_Name:
597+
m_EditorClassIdentifier:
598+
m_IgnoreReversedGraphics: 1
599+
m_BlockingObjects: 0
600+
m_BlockingMask:
601+
serializedVersion: 2
602+
m_Bits: 4294967295
585603
--- !u!1 &1057458229063515816
586604
GameObject:
587605
m_ObjectHideFlags: 0

Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Multiplayer Samples Co-op Changelog
22

3+
## [Unreleased] - yyyy-mm-dd
4+
5+
### Added
6+
* ClientLoadingScreen now sets raycast blocking to true when the loading screen is visible (#760)
7+
### Changed
8+
*
9+
### Removed
10+
*
11+
### Fixed
12+
*
13+
314
## [1.4.0] - 2022-10-06
415

516
### Added

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void Awake()
7171

7272
void Start()
7373
{
74-
m_CanvasGroup.alpha = 0;
74+
SetCanvasVisibility(false);
7575
m_LoadingProgressManager.onTrackersUpdated += OnProgressTrackersUpdated;
7676
}
7777

@@ -130,7 +130,7 @@ public void StopLoadingScreen()
130130

131131
public void StartLoadingScreen(string sceneName)
132132
{
133-
m_CanvasGroup.alpha = 1;
133+
SetCanvasVisibility(true);
134134
m_LoadingScreenRunning = true;
135135
UpdateLoadingScreen(sceneName);
136136
ReinitializeProgressBars();
@@ -220,6 +220,12 @@ public void UpdateLoadingScreen(string sceneName)
220220
}
221221
}
222222

223+
void SetCanvasVisibility(bool visible)
224+
{
225+
m_CanvasGroup.alpha = visible ? 1 : 0;
226+
m_CanvasGroup.blocksRaycasts = visible;
227+
}
228+
223229
IEnumerator FadeOutCoroutine()
224230
{
225231
yield return new WaitForSeconds(m_DelayBeforeFadeOut);
@@ -233,7 +239,7 @@ IEnumerator FadeOutCoroutine()
233239
currentTime += Time.deltaTime;
234240
}
235241

236-
m_CanvasGroup.alpha = 0;
242+
SetCanvasVisibility(false);
237243
}
238244
}
239245
}

0 commit comments

Comments
 (0)