From 11c6890da2f384e20acdedf3de553061957bfa8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Cor=C3=A9n?= <2108U9@gmail.com> Date: Mon, 9 Apr 2018 17:03:25 +0200 Subject: [PATCH 1/2] Added XML documentation for NetworkedPrefab class --- MLAPI/Data/NetworkedPrefab.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MLAPI/Data/NetworkedPrefab.cs b/MLAPI/Data/NetworkedPrefab.cs index e42b548..9354827 100644 --- a/MLAPI/Data/NetworkedPrefab.cs +++ b/MLAPI/Data/NetworkedPrefab.cs @@ -3,10 +3,19 @@ using UnityEngine; namespace MLAPI.Data { + /// + /// A class that represents a NetworkedPrefab + /// [Serializable] public class NetworkedPrefab { + /// + /// The name of the networked prefab + /// public string name; + /// + /// The gameobject of the prefab + /// public GameObject prefab; } } From ac31f460893661bb326310297a7910d37cea4e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albin=20Cor=C3=A9n?= <2108U9@gmail.com> Date: Tue, 10 Apr 2018 18:26:52 +0200 Subject: [PATCH 2/2] Fixed nullRef on first OnValidate call --- MLAPI/MLAPI.csproj | 4 ++-- MLAPI/MonoBehaviours/Core/NetworkingManager.cs | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/MLAPI/MLAPI.csproj b/MLAPI/MLAPI.csproj index d9d439f..f0b660f 100644 --- a/MLAPI/MLAPI.csproj +++ b/MLAPI/MLAPI.csproj @@ -36,13 +36,13 @@ true - ..\..\MLAPI-Examples\Assets\ + ..\..\MLAPI-Examples\Assets\MLAPI\ DEBUG;TRACE full AnyCPU prompt MinimumRecommendedRules.ruleset - Auto + Off false diff --git a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs index 7b2f67b..021640c 100644 --- a/MLAPI/MonoBehaviours/Core/NetworkingManager.cs +++ b/MLAPI/MonoBehaviours/Core/NetworkingManager.cs @@ -153,15 +153,20 @@ namespace MLAPI.MonoBehaviours.Core private void OnValidate() { + if (NetworkConfig == null) + return; //May occur when the component is added + if(NetworkConfig.EnableSceneSwitching && !NetworkConfig.RegisteredScenes.Contains(SceneManager.GetActiveScene().name)) { Debug.LogWarning("MLAPI: The active scene is not registered as a networked scene. The MLAPI has added it"); NetworkConfig.RegisteredScenes.Add(SceneManager.GetActiveScene().name); } + if(!NetworkConfig.EnableSceneSwitching && NetworkConfig.HandleObjectSpawning) { Debug.LogWarning("MLAPI: Please be aware that Scene objects are NOT supported if SceneManagement is turned on, even if HandleObjectSpawning is turned on"); } + if(NetworkConfig.HandleObjectSpawning) { for (int i = 0; i < NetworkConfig.NetworkedPrefabs.Count; i++) @@ -173,6 +178,7 @@ namespace MLAPI.MonoBehaviours.Core } } } + if (NetworkConfig.HandleObjectSpawning) { if(!string.IsNullOrEmpty(NetworkConfig.PlayerPrefabName)) @@ -198,7 +204,9 @@ namespace MLAPI.MonoBehaviours.Core } if (!NetworkConfig.EnableEncryption) + { RegenerateRSAKeys = false; + } else { if(RegenerateRSAKeys)