Created a single prefab to incorporate all the networking stuff. This is the only networking prefab required in the scene. We will see if git breaks it.

This commit is contained in:
2026-02-02 20:35:25 +02:00
parent 216e2660df
commit 91e44c5dae
4 changed files with 2270 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using FishNet.Component.Spawning;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.Newtonsoft.Json.Converters;
using static UnityEditor.ShaderGraph.Internal.KeywordDependentCollection;
public class CustomNetworkManager : MonoBehaviour
{
public static CustomNetworkManager instance = null;
public PlayerSpawner playerSpawner;
void Awake()
{
if (!instance) { instance = this; }
else if (instance != this) { Destroy(gameObject); }
DontDestroyOnLoad(gameObject);
}
private void Start()
{
if (playerSpawner.Spawns.Length == 0) {
Debug.LogWarning("Player spawns undefined. Assign a player spawn to PlayerSpawner!");
} else {
bool hasSpawn = false;
foreach (Transform spawn in playerSpawner.Spawns)
{
hasSpawn |= spawn != null;
}
if (!hasSpawn)
{
Debug.LogWarning("Player spawns undefined. Assign a player spawn to PlayerSpawner!");
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 067fc70e6bd1a024ba644f52017165fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 67f163b4eb8c8df43b48aab810b8a0a8
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: