fix: keep only one server comp

This commit is contained in:
anavoi 2025-07-12 23:28:33 +02:00
commit 05256ecd8a

View file

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Reflection;
using BepInEx;
using BepInEx.Logging;
@ -62,6 +62,18 @@ public class Plugin : BaseUnityPlugin
public static void AddServerComp()
{
Component[] comps = GBSUCompContainer.GetComponents(typeof(Component));
foreach (var comp in comps)
{
Log.LogDebug("iterating thru singleton comps");
if(comp is GBSUServer)
{
Log.LogDebug("GBSUServer component was found! Destroying it");
Destroy(comp);
}
}
Log.LogDebug("Adding GBSUServer component");
GBSUCompContainer.AddComponent<GBSUServer>();
}