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:
40
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs
Normal file
40
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs
Normal 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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs.meta
Normal file
11
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 067fc70e6bd1a024ba644f52017165fd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2212
Assets/_PROJECT/Multiplayer/Networking.prefab
Normal file
2212
Assets/_PROJECT/Multiplayer/Networking.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/_PROJECT/Multiplayer/Networking.prefab.meta
Normal file
7
Assets/_PROJECT/Multiplayer/Networking.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67f163b4eb8c8df43b48aab810b8a0a8
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user