Skip to content

Commit 863cd81

Browse files
author
FirstGearGames
committed
4.6.11
- Fixed builds not completing while parrelsync was imported. - Fixed BandwidthDisplay NullReferenceExceptions.
1 parent 8515c8b commit 863cd81

File tree

6 files changed

+34
-13
lines changed

6 files changed

+34
-13
lines changed

Assets/FishNet/Runtime/Editor/Configuring/ConfigurationEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class RefreshDefaultPrefabsMenu : MonoBehaviour
8383
[MenuItem("Tools/Fish-Networking/Utility/Refresh Default Prefabs", false, 300)]
8484
public static void RebuildDefaultPrefabs()
8585
{
86-
#if PARRELSYNC
86+
#if PARRELSYNC && UNITY_EDITOR
8787
if (ParrelSync.ClonesManager.IsClone() && ParrelSync.Preferences.AssetModPref.Value)
8888
{
8989
Debug.Log("Cannot perform this operation on a ParrelSync clone");

Assets/FishNet/Runtime/Editor/Configuring/EditorCloning/CloneChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static bool IsMultiplayerClone(out EditorCloneType editorCloneType)
1616
return true;
1717
}
1818

19-
#if PARRELSYNC
19+
#if PARRELSYNC && UNITY_EDITOR
2020
if (ParrelSync.ClonesManager.IsClone())
2121
{
2222
editorCloneType = EditorCloneType.ParrelSync;

Assets/FishNet/Runtime/Editor/PrefabCollectionGenerator/Generator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static string GetDirtiedMessage(PrefabGeneratorConfigurations settings,
153153
/// </summary>
154154
public static void GenerateChanged(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths, PrefabGeneratorConfigurations settings = null)
155155
{
156-
#if PARRELSYNC
156+
#if PARRELSYNC && UNITY_EDITOR
157157
if (ParrelSync.ClonesManager.IsClone() && ParrelSync.Preferences.AssetModPref.Value)
158158
{
159159
UnityDebug.Log("Skipping prefab generation in ParrelSync clone");
@@ -334,7 +334,7 @@ internal static List<NetworkObject> GetNetworkObjects(List<SpecifiedFolder> spec
334334
/// </summary>
335335
public static void GenerateFull(PrefabGeneratorConfigurations settings = null, bool forced = false, bool initializeAdded = true)
336336
{
337-
#if PARRELSYNC
337+
#if PARRELSYNC && UNITY_EDITOR
338338
if (ParrelSync.ClonesManager.IsClone() && ParrelSync.Preferences.AssetModPref.Value)
339339
{
340340
UnityDebug.Log("Skipping prefab generation in ParrelSync clone");
@@ -540,7 +540,7 @@ internal static DefaultPrefabObjects GetDefaultPrefabObjects(PrefabGeneratorConf
540540
}
541541
}
542542

543-
#if PARRELSYNC
543+
#if PARRELSYNC && UNITY_EDITOR
544544
if (!ParrelSync.ClonesManager.IsClone() && ParrelSync.Preferences.AssetModPref.Value)
545545
{
546546
#endif
@@ -560,7 +560,7 @@ internal static DefaultPrefabObjects GetDefaultPrefabObjects(PrefabGeneratorConf
560560
AssetDatabase.CreateAsset(_cachedDefaultPrefabs, defaultPrefabsPath);
561561
AssetDatabase.SaveAssets();
562562
}
563-
#if PARRELSYNC
563+
#if PARRELSYNC && UNITY_EDITOR
564564
}
565565
#endif
566566

Assets/FishNet/Runtime/Generated/Component/Utility/BandwidthDisplay.cs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,17 @@ public void InitializeState(int capacity)
162162
/// </summary>
163163
private NetworkTrafficStatistics _networkTrafficStatistics;
164164
/// <summary>
165-
/// Next time server text can be updated.
165+
/// Next time the server text can be updated.
166166
/// </summary>
167167
private float _nextServerTextUpdateTime;
168168
/// <summary>
169-
/// Next time server text can be updated.
169+
/// Next time the server text can be updated.
170170
/// </summary>
171171
private float _nextClientTextUpdateTime;
172+
/// <summary>
173+
/// True if component is initialized.
174+
/// </summary>
175+
private bool _initialized;
172176
#endregion
173177

174178
private void Start()
@@ -187,12 +191,17 @@ private void Start()
187191
if (!InstanceFinder.NetworkManager.StatisticsManager.TryGetNetworkTrafficStatistics(out _networkTrafficStatistics))
188192
return;
189193

194+
if (!_networkTrafficStatistics.UpdateClient && !_networkTrafficStatistics.UpdateServer)
195+
{
196+
Debug.LogWarning($"StatisticsManager.NetworkTraffic is not updating for client nor server. To see results ensure your NetworkManager has a StatisticsManager component added with the NetworkTraffic values configured.");
197+
return;
198+
}
199+
190200
SetSecondsAveraged(_secondsAveraged);
191201

192202
_networkTrafficStatistics.OnNetworkTraffic += NetworkTrafficStatistics_OnNetworkTraffic;
193-
194-
if (!_networkTrafficStatistics.UpdateClient && !_networkTrafficStatistics.UpdateServer)
195-
Debug.LogWarning($"StatisticsManager.NetworkTraffic is not updating for client nor server. To see results ensure your NetworkManager has a StatisticsManager component added with the NetworkTraffic values configured.");
203+
204+
_initialized = true;
196205
}
197206

198207
private void OnDestroy()
@@ -228,6 +237,9 @@ public void SetSecondsAveraged(byte seconds)
228237
/// </summary>
229238
private void NetworkTrafficStatistics_OnNetworkTraffic(uint tick, BidirectionalNetworkTraffic serverTraffic, BidirectionalNetworkTraffic clientTraffic)
230239
{
240+
if (!_initialized)
241+
return;
242+
231243
ServerAverages.AddIn(serverTraffic.InboundTraffic.Bytes);
232244
ServerAverages.AddOut(serverTraffic.OutboundTraffic.Bytes);
233245

@@ -264,6 +276,9 @@ private void NetworkTrafficStatistics_OnNetworkTraffic(uint tick, BidirectionalN
264276
/// </summary>
265277
private void NetworkTraffic_OnClientNetworkTraffic(BidirectionalNetworkTraffic traffic)
266278
{
279+
if (!_initialized)
280+
return;
281+
267282
ClientAverages.AddIn(traffic.InboundTraffic.Bytes);
268283
ClientAverages.AddOut(traffic.OutboundTraffic.Bytes);
269284

@@ -287,6 +302,9 @@ private void NetworkTraffic_OnClientNetworkTraffic(BidirectionalNetworkTraffic t
287302
/// </summary>
288303
private void NetworkTraffic_OnServerNetworkTraffic(BidirectionalNetworkTraffic traffic)
289304
{
305+
if (!_initialized)
306+
return;
307+
290308
ServerAverages.AddIn(traffic.InboundTraffic.Bytes);
291309
ServerAverages.AddOut(traffic.OutboundTraffic.Bytes);
292310

@@ -368,6 +386,9 @@ public void ResetAverages()
368386

369387
private void ResetCalculationsAndDisplay(bool forServer)
370388
{
389+
if (!_initialized)
390+
return;
391+
371392
if (forServer)
372393
{
373394
_serverText = string.Empty;

Assets/FishNet/Runtime/Managing/NetworkManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ internal void SetBroadcastName<T>(ushort key) where T : struct, IBroadcast
227227
/// <summary>
228228
/// Version of this release.
229229
/// </summary>
230-
public const string FISHNET_VERSION = "4.6.10";
230+
public const string FISHNET_VERSION = "4.6.11";
231231
/// <summary>
232232
/// Maximum framerate allowed.
233233
/// </summary>

Assets/FishNet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.firstgeargames.fishnet",
3-
"version": "4.6.10",
3+
"version": "4.6.11",
44
"displayName": "FishNet: Networking Evolved",
55
"description": "A feature-rich Unity networking solution aimed towards reliability, ease of use, efficiency, and flexibility.",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)