Hi, I was following the wiki on custom networking and more or less have the exact layout as follows:
[HarmonyPostfix, HarmonyPatch(typeof(RoundManager), nameof(RoundManager.GenerateNewLevelClientRpc))]
static void SubscribeToHandler()
{
ExampleNetworkHandler.LevelEvent += ReceivedEventFromServer;
}
[HarmonyPostfix, HarmonyPatch(typeof(RoundManager), nameof(RoundManager.DespawnPropsAtEndOfRound))]
static void UnsubscribeFromHandler()
{
ExampleNetworkHandler.LevelEvent -= ReceivedEventFromServer;
}
But the SubscribeToHandler() subscribes twice for some reason on the host. It subscribes just once if it's just a client and NOT the host. Since that happens, I suspect it's a problem with differentiating those two...
I've tried putting an if statement inside "SubscribeToHandler()" that filters on like "!NetworkManager.Singleton.IsHost" and "!RoundsManager.Instance.IsHost" and other iterations checking if it's JUST the client then subscribe once, but it doesn't work ofc