41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
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!");
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|