-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathUtils.cs
28 lines (25 loc) · 797 Bytes
/
Utils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using HarmonyLib;
using System.Collections.Generic;
using UnityEngine;
using Unity.Netcode;
namespace AdvancedCompany
{
[HarmonyPatch]
public class Utils
{
private static List<GameObject> NetworkPrefabs = new List<GameObject>();
private static bool NetworkManagerStarted = false;
public static NetworkManager NetworkManager;
public static void AddNetworkPrefab(GameObject go)
{
NetworkPrefabs.Add(go);
}
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
[HarmonyPostfix]
private static void Start(GameNetworkManager __instance)
{
for (var i = 0; i < NetworkPrefabs.Count; i++)
NetworkManager.Singleton.AddNetworkPrefab(NetworkPrefabs[i]);
}
}
}