Skip to content

Commit 1be07a6

Browse files
author
FirstGearGames
committed
1.1.0.Nightly.0
- Added Warning to PredictedRigidbody inspector. - Improved XML for FrameRate and MaximumClientMTU. - Changed sealed ClientManager, ServerManager, TimeManager, Observermanager, NetworkObject, NetworkManager, NetworkObserver. - Fixed IsNetworked not being set true for client spawns. - Improved internally ServerManager.MaximumClientMTU. - Changed channels count is now hard-coded at 2, for reliable and unreliable. - Obsoleted GetChannelCount() from Transport. Will be removed 2022/06/01.
1 parent 83fd54b commit 1be07a6

35 files changed

+180
-115
lines changed

Assets/FishNet/Runtime/Connection/NetworkConnection.Buffer.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using FishNet.Broadcast;
22
using FishNet.Managing;
33
using FishNet.Managing.Logging;
4+
using FishNet.Managing.Transporting;
45
using FishNet.Transporting;
56
using System;
67
using System.Collections.Generic;
@@ -27,8 +28,7 @@ public partial class NetworkConnection
2728
/// </summary>
2829
private void InitializeBuffer()
2930
{
30-
int channels = NetworkManager.TransportManager.Transport.GetChannelCount();
31-
for (byte i = 0; i < channels; i++)
31+
for (byte i = 0; i < TransportManager.CHANNEL_COUNT; i++)
3232
{
3333
int mtu = NetworkManager.TransportManager.Transport.GetMTU(i);
3434
_toClientBundles.Add(new PacketBundle(NetworkManager, mtu));
@@ -71,12 +71,14 @@ internal void SendToClient(byte channel, ArraySegment<byte> segment, bool forceN
7171
Debug.LogWarning($"Data cannot be sent to connection {ClientId} because it is not active.");
7272
return;
7373
}
74+
//If channel is out of bounds then default to the first channel.
7475
if (channel >= _toClientBundles.Count)
75-
{
76-
if (NetworkManager.CanLog(LoggingType.Error))
77-
Debug.LogError($"Channel {channel} is out of bounds.");
78-
return;
79-
}
76+
channel = 0;
77+
//{
78+
// if (NetworkManager.CanLog(LoggingType.Error))
79+
// Debug.LogError($"Channel {channel} is out of bounds.");
80+
// return;
81+
//}
8082

8183
_toClientBundles[channel].Write(segment, forceNewBuffer);
8284
ServerDirty();

Assets/FishNet/Runtime/Generated/Component/Prediction/Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#if UNITY_EDITOR
2+
using UnityEditor;
3+
using UnityEngine;
4+
5+
namespace FishNet.Component.Prediction.Editing
6+
{
7+
[CustomEditor(typeof(PredictedRigidbody), true)]
8+
[CanEditMultipleObjects]
9+
public class PredictedRigidbodyEditor : Editor
10+
{
11+
public override void OnInspectorGUI()
12+
{
13+
14+
serializedObject.Update();
15+
16+
EditorGUILayout.HelpBox("This component is still in development and may not behave properly.", MessageType.Warning);
17+
18+
SerializedProperty p = serializedObject.GetIterator();
19+
do
20+
{
21+
if (p.name == "Base")
22+
{
23+
continue;
24+
}
25+
//Script reference.
26+
else if (p.name == "m_Script")
27+
{
28+
GUI.enabled = false;
29+
EditorGUILayout.PropertyField(p);
30+
GUI.enabled = true;
31+
}
32+
else
33+
{
34+
EditorGUILayout.PropertyField(p);
35+
}
36+
}
37+
while (p.NextVisible(true));
38+
39+
serializedObject.ApplyModifiedProperties();
40+
}
41+
}
42+
}
43+
44+
#endif

Assets/FishNet/Runtime/Generated/Component/Prediction/Editor/PredictedRigidbodyEditor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FishNet/Runtime/InstanceFinder.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
using FishNet.Utility;
99
using System.Linq;
1010
using UnityEngine;
11-
#if UNITY_EDITOR
12-
#endif
1311

1412
namespace FishNet
1513
{

Assets/FishNet/Runtime/Managing/Client/ClientManager.Broadcast.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace FishNet.Managing.Client
1212
{
13-
public partial class ClientManager : MonoBehaviour
13+
public sealed partial class ClientManager : MonoBehaviour
1414
{
1515
#region Private.
1616
/// <summary>

Assets/FishNet/Runtime/Managing/Client/ClientManager.RpcLinks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace FishNet.Managing.Client
77
{
8-
public partial class ClientManager : MonoBehaviour
8+
public sealed partial class ClientManager : MonoBehaviour
99
{
1010
#region Private.
1111
/// <summary>

Assets/FishNet/Runtime/Managing/Client/ClientManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace FishNet.Managing.Client
1212
/// A container for local client data and actions.
1313
/// </summary>
1414
[DisallowMultipleComponent]
15-
public partial class ClientManager : MonoBehaviour
15+
public sealed partial class ClientManager : MonoBehaviour
1616
{
1717
#region Public.
1818
/// <summary>
@@ -42,12 +42,12 @@ public partial class ClientManager : MonoBehaviour
4242
/// <summary>
4343
///
4444
/// </summary>
45-
[Tooltip("Maximum frame rate the client may run at. When as host this value runs at whichever is higher between client and server.")]
45+
[Tooltip("Frame rate to use while only the client is active. When both server and client are active the higher of the two frame rates will be used.")]
4646
[Range(1, NetworkManager.MAXIMUM_FRAMERATE)]
4747
[SerializeField]
4848
private ushort _frameRate = NetworkManager.MAXIMUM_FRAMERATE;
4949
/// <summary>
50-
/// Maximum frame rate the client may run at. When as host this value runs at whichever is higher between client and server.
50+
/// Frame rate to use while only the client is active. When both server and client are active the higher of the two frame rates will be used.
5151
/// </summary>
5252
internal ushort FrameRate => _frameRate;
5353
#endregion

Assets/FishNet/Runtime/Managing/Client/Object/ClientObjects.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ internal void CacheSpawn(PooledReader reader)
271271

272272
return;
273273
}
274+
else
275+
{
276+
nob.SetIsNetworked(true);
277+
}
274278
/* If not host then pre-initialize. Pre-initializing applies
275279
* values needed to run such as owner, network manager, and completes
276280
* other reference creating functions. */

Assets/FishNet/Runtime/Managing/NetworkManager.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using System;
1717
using FishNet.Managing.Observing;
1818
using System.Linq;
19+
using FishNet.Utility.Extension;
1920

2021
namespace FishNet.Managing
2122
{
@@ -24,7 +25,7 @@ namespace FishNet.Managing
2425
/// </summary>
2526
[DefaultExecutionOrder(short.MinValue)]
2627
[DisallowMultipleComponent]
27-
public partial class NetworkManager : MonoBehaviour
28+
public sealed partial class NetworkManager : MonoBehaviour
2829
{
2930
#region Types.
3031
/// <summary>
@@ -171,8 +172,8 @@ public static IReadOnlyCollection<NetworkManager> Instances
171172
#endregion
172173

173174

174-
protected virtual void Awake()
175-
{
175+
private void Awake()
176+
{
176177
InitializeLogging();
177178

178179
_canPersist = CanInitialize();
@@ -385,7 +386,7 @@ private void OnValidate()
385386
if (SpawnablePrefabs == null)
386387
Reset();
387388
}
388-
protected virtual void Reset()
389+
private void Reset()
389390
{
390391
if (SpawnablePrefabs == null)
391392
{
@@ -399,6 +400,7 @@ protected virtual void Reset()
399400
}
400401
}
401402
#endif
403+
402404
#endregion
403405

404406
}

0 commit comments

Comments
 (0)