diff --git a/QSB/HUD/MultiplayerHUDManager.cs b/QSB/HUD/MultiplayerHUDManager.cs index fe698ba1..04c6f2a2 100644 --- a/QSB/HUD/MultiplayerHUDManager.cs +++ b/QSB/HUD/MultiplayerHUDManager.cs @@ -23,6 +23,7 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart private Transform _textChat; private InputField _inputField; private Material _markerMaterial; + private bool _ready; public static Sprite UnknownSprite; public static Sprite DeadSprite; @@ -64,6 +65,11 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart Interloper = QSBCore.HUDAssetBundle.LoadAsset("Assets/MULTIPLAYER_UI/playerbox_interloper.png"); WhiteHole = QSBCore.HUDAssetBundle.LoadAsset("Assets/MULTIPLAYER_UI/playerbox_whitehole.png"); SpaceSprite = QSBCore.HUDAssetBundle.LoadAsset("Assets/MULTIPLAYER_UI/playerbox_space.png"); + + QSBSceneManager.OnPostSceneLoad += (OWScene old, OWScene newScene) => + { + _ready = false; + }; } private const int LINE_COUNT = 11; @@ -79,6 +85,12 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart public void WriteMessage(string message, Color color) { + // dont write messages when not ready + if (!_ready) + { + return; + } + /* Tricky problem to solve. * - 11 available lines for text to fit onto * - Each line can be max 41 characters @@ -307,6 +319,8 @@ internal class MultiplayerHUDManager : MonoBehaviour, IAddComponentOnStart _lines.Clear(); _messages.Clear(); _textChat.GetComponent().alpha = 0; + + _ready = true; } public void UpdateMinimapMarkers(Minimap minimap)