fix: keep only one server comp
This commit is contained in:
parent
5aa379ca9d
commit
05256ecd8a
1 changed files with 83 additions and 71 deletions
14
Plugin.cs
14
Plugin.cs
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
using BepInEx.Logging;
|
using BepInEx.Logging;
|
||||||
|
|
@ -62,6 +62,18 @@ public class Plugin : BaseUnityPlugin
|
||||||
|
|
||||||
public static void AddServerComp()
|
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>();
|
GBSUCompContainer.AddComponent<GBSUServer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue