From ed2f1d72b96d677f647784ca9c9bc98af9d67f33 Mon Sep 17 00:00:00 2001 From: Riccardo Bovo Date: Thu, 19 Dec 2024 09:38:04 +0000 Subject: [PATCH] Disable passthrough in multiplayer --- Assets/Scripts/GUI/LightingPopUpWindow.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Assets/Scripts/GUI/LightingPopUpWindow.cs b/Assets/Scripts/GUI/LightingPopUpWindow.cs index 61be8830df..8c4e35cd4b 100644 --- a/Assets/Scripts/GUI/LightingPopUpWindow.cs +++ b/Assets/Scripts/GUI/LightingPopUpWindow.cs @@ -23,6 +23,7 @@ using UnityEngine; using System.Collections.Generic; using System.Linq; +using OpenBrush.Multiplayer; namespace TiltBrush { @@ -75,6 +76,9 @@ override public void Init(GameObject rParent, string sText) } #endif // PASSTHROUGH_SUPPORTED + // Disable passthrough button if in room + if (MultiplayerManager.m_Instance.State == ConnectionState.IN_ROOM) DisablePassthroughButton(); + //find the active lighting preset TiltBrush.Environment rCurrentPreset = SceneSettings.m_Instance.GetDesiredPreset(); if (rCurrentPreset != null) @@ -157,5 +161,19 @@ void OnDestroy() { SceneSettings.m_Instance.FadingToDesiredEnvironment -= OnFadingToDesiredEnvironment; } + + public void DisablePassthroughButton() + { + for (int i = 0; i < m_Environments.Count; i++) + { + if (m_Environments[i].m_Guid.ToString() == PASSTHROUGH_GUID) + { + BaseButton button = m_Icons[i]?.m_IconScript as BaseButton; + if (button != null) button.SetButtonAvailable(false); + break; + } + } + } + } } // namespace TiltBrush