mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
Add null check when moving player data, fix game crashing
This commit is contained in:
1 parent
1d3e8a033e
commit
93ac632947
2 files changed
+9
-3
No files matched your search
@@ -26,7 +26,7 @@ internal abstract class BaseCommand
|
||||
internal abstract string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the short names (aliases) for the command.
|
||||
/// Gets the short names for the command.
|
||||
/// </summary>
|
||||
internal virtual string[] ShortNames => [];
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using BepInEx.Unity.IL2CPP.Utils;
|
||||
using BetterAmongUs.Utilities;
|
||||
using BetterAmongUs.Managers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules.Support;
|
||||
using BetterAmongUs.Patches.Gameplay.UI.Chat;
|
||||
using BetterAmongUs.Utilities;
|
||||
using BetterAmongUs.Utilities.Extension;
|
||||
using HarmonyLib;
|
||||
using InnerNet;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using BetterAmongUs.Utilities.Extension;
|
||||
|
||||
namespace BetterAmongUs.Patches.Client;
|
||||
|
||||
@@ -96,6 +96,9 @@ internal static class ClientPatch
|
||||
// Preserve all player GameObjects during scene transitions
|
||||
foreach (var data in GameData.Instance.AllPlayers)
|
||||
{
|
||||
if (data == null || data.gameObject == null)
|
||||
continue;
|
||||
|
||||
UnityEngine.Object.DontDestroyOnLoad(data.gameObject);
|
||||
}
|
||||
|
||||
@@ -104,6 +107,9 @@ internal static class ClientPatch
|
||||
{
|
||||
foreach (var data in GameData.Instance.AllPlayers)
|
||||
{
|
||||
if (data == null || data.gameObject == null)
|
||||
continue;
|
||||
|
||||
SceneManager.MoveGameObjectToScene(data.gameObject, SceneManager.GetActiveScene());
|
||||
}
|
||||
}, 0.6f, shouldLog: false);
|
||||
|
||||
Reference in new issue
Block a user