Skip to content

Commit c73c803

Browse files
author
FirstGearGames
committed
4.6.12
- Fixed another NullReferenceException when NetworkTrafficStatics were enabled. - Added NetworkTransform.SetInterpolation. - Added NetworkTransform.SetExtrapolation.
1 parent 863cd81 commit c73c803

File tree

12 files changed

+62
-79
lines changed

12 files changed

+62
-79
lines changed

Assets/FishNet/CodeGenerating/Processing/Rpc/RpcProcessor.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,6 @@ private MethodDefinition CreateRpcLogicMethod(List<AttributeData> datas, Created
854854
TypeDefinition typeDef = cr.TypeDef;
855855
MethodDefinition originalMd = cr.OriginalMethodDef;
856856

857-
858-
859857
//Methodname for logic methods do not use prefixes because there can be only one.
860858
string methodName = $"{LOGIC_PREFIX}{GetMethodNameAsParameters(originalMd)}";
861859

@@ -968,8 +966,6 @@ private void RedirectOriginalToWriter(List<CreatedRpc> createdRpcs)
968966
* entry. */
969967
MethodDefinition originalMd = createdRpcs[0].OriginalMethodDef;
970968

971-
972-
973969
ILProcessor processor = originalMd.Body.GetILProcessor();
974970
originalMd.Body.Instructions.Clear();
975971

Assets/FishNet/Runtime/Editor/NetworkProfiler/Types.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,16 @@ public BidirectionalNetworkTraffic CloneUsingCache()
5959

6060
return traffic;
6161
}
62-
62+
63+
/// <summary>
64+
/// Re-initializes by calling ResetState, then InitializeState.
65+
/// </summary>
66+
public void Reinitialize()
67+
{
68+
ResetState();
69+
InitializeState();
70+
}
71+
6372
public void ResetState()
6473
{
6574
ResettableObjectCaches<NetworkTraffic>.StoreAndDefault(ref InboundTraffic);
@@ -234,6 +243,7 @@ public void SetPacketGroupPercentages()
234243

235244
public void ResetState()
236245
{
246+
Bytes = 0;
237247
ResettableT2CollectionCaches<PacketId, PacketGroup>.StoreAndDefault(ref _packetGroups);
238248
}
239249

Assets/FishNet/Runtime/Generated/Component/NetworkAnimator/NetworkAnimator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,6 @@ private void InitializeOnce()
647647
foreach (AnimatorControllerParameter item in _animator.parameters)
648648
{
649649
bool process = !_animator.IsParameterControlledByCurve(item.name);
650-
651650
if (process)
652651
{
653652
//Over 250 parameters; who would do this!?

Assets/FishNet/Runtime/Generated/Component/NetworkTransform/Editor/NetworkTransformEditor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public override void OnInspectorGUI()
5959
LayoutTools.AddObjectField("Script:", MonoScript.FromMonoBehaviour((NetworkTransform)target), typeof(NetworkTransform), false, EditorLayoutEnableType.Disabled);
6060

6161
bool isPro = false;
62-
6362
if (isPro)
6463
EditorGUILayout.HelpBox(EditingConstants.PRO_ASSETS_UNLOCKED_TEXT, MessageType.None);
6564
else

Assets/FishNet/Runtime/Generated/Component/NetworkTransform/NetworkTransform.cs

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ public void SetSendToOwner(bool value)
445445
/// </summary>
446446
/// <param name = "value">New value.</param>
447447
public void SetSynchronizePosition(bool value) => _synchronizePosition = value;
448+
448449
/// <summary>
449450
/// Distance sensitivity on position checks.
450451
/// </summary>
@@ -504,6 +505,7 @@ public void SetSendToOwner(bool value)
504505
[Range(0.00001f, 1.25f)]
505506
[SerializeField]
506507
private float _scaleSensitivity = 0.001f;
508+
507509
/// <summary>
508510
/// Sets if to synchronize scale.
509511
/// </summary>
@@ -971,6 +973,25 @@ private void ChangeUpdateSubscription(bool subscribe)
971973
_timeManager.OnUpdate -= TimeManager_OnUpdate;
972974
}
973975

976+
/// <summary>
977+
/// Sets the interpolation value.
978+
/// </summary>
979+
public void SetInterpolation(ushort value)
980+
{
981+
if (value < 1)
982+
value = 1;
983+
984+
_interpolation = value;
985+
}
986+
987+
/// <summary>
988+
/// Sets the extrapolation value.
989+
/// </summary>
990+
public void SetExtrapolation(ushort value)
991+
{
992+
_extrapolation = value;
993+
}
994+
974995
/// <summary>
975996
/// Returns if controlling logic can be run. This may be the server when there is no owner, even if client authoritative, and more.
976997
/// </summary>
@@ -979,15 +1000,12 @@ private bool CanControl()
9791000
{
9801001
//Client auth.
9811002
if (_clientAuthoritative)
982-
{
9831003
return IsController;
984-
}
1004+
1005+
9851006
//Server auth.
986-
else
987-
{
988-
if (IsServerInitialized)
989-
return true;
990-
}
1007+
if (IsServerInitialized)
1008+
return true;
9911009

9921010
//Fall through.
9931011
return false;
@@ -1625,17 +1643,15 @@ private void MoveToTarget(float delta)
16251643
//No more in buffer, see if can extrapolate.
16261644
else
16271645
{
1628-
1629-
/* If everything matches up then end queue.
1646+
/* If everything matches up then end queue.
16301647
* Otherwise let it play out until stuff
16311648
* aligns. Generally the time remaining is enough
16321649
* but every once in awhile something goes funky
16331650
* and it's thrown off. */
16341651
if (!HasChanged(td))
16351652
_currentGoalData = null;
16361653
OnInterpolationComplete?.Invoke();
1637-
1638-
}
1654+
}
16391655
}
16401656
}
16411657

@@ -2135,13 +2151,12 @@ private uint GetTickDifference(TransformData prevTd, GoalData nextGd, uint minim
21352151
/// <summary>
21362152
/// Sets extrapolation data on next.
21372153
/// </summary>
2138-
private void SetExtrapolation(TransformData prev, TransformData next, Channel channel)
2154+
private void SetExtrapolatedData(TransformData prev, TransformData next, Channel channel)
21392155
{
21402156
//Default value.
21412157
next.ExtrapolationState = TransformData.ExtrapolateState.Disabled;
21422158

2143-
2144-
}
2159+
}
21452160

21462161
/// <summary>
21472162
/// Updates a client with transform data.
@@ -2224,7 +2239,7 @@ private void DataReceived(ArraySegment<byte> data, Channel channel, bool asServe
22242239
UpdateTransformData(data, prevTd, nextTd, ref changedFull);
22252240

22262241
OnDataReceived?.Invoke(prevTd, nextTd);
2227-
SetExtrapolation(prevTd, nextTd, channel);
2242+
SetExtrapolatedData(prevTd, nextTd, channel);
22282243

22292244
bool hasChanged = HasChanged(prevTd, nextTd);
22302245

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private void NetworkTrafficStatistics_OnNetworkTraffic(uint tick, BidirectionalN
239239
{
240240
if (!_initialized)
241241
return;
242-
242+
243243
ServerAverages.AddIn(serverTraffic.InboundTraffic.Bytes);
244244
ServerAverages.AddOut(serverTraffic.OutboundTraffic.Bytes);
245245

@@ -252,7 +252,7 @@ private void NetworkTrafficStatistics_OnNetworkTraffic(uint tick, BidirectionalN
252252

253253
string nl = System.Environment.NewLine;
254254
string result = string.Empty;
255-
255+
256256
if (_showIncoming)
257257
result += $"Server In: {NetworkTrafficStatistics.FormatBytesToLargest(ServerAverages.GetAverage(inAverage: true))}/s{nl}";
258258
if (_showOutgoing)

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.11";
230+
public const string FISHNET_VERSION = "4.6.12";
231231
/// <summary>
232232
/// Maximum framerate allowed.
233233
/// </summary>

Assets/FishNet/Runtime/Managing/Statistic/NetworkTrafficStatistics.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,16 @@ private void TimeManager_OnPreTick()
143143
* the traffic stat fields are reset. Each listener should use
144144
* the MultiwayTrafficCollection.Clone method to get a copy,
145145
* and should cache that copy when done. */
146-
_clientTraffic.ResetState();
147-
_serverTraffic.ResetState();
146+
_clientTraffic.Reinitialize();
147+
_serverTraffic.Reinitialize();
148148
}
149149

150150
/// <summary>
151151
/// Called when a packet bundle is received. This is any number of packets bundled into a single transmission.
152152
/// </summary>
153153
internal void PacketBundleReceived(bool asServer)
154154
{
155-
Debug.LogError("Inbound and outbound bidirection datas should count up how many packet bundles are received. This is so the bundle headers can be calculated appropriately.");
155+
//Debug.LogError("Inbound and outbound bidirection datas should count up how many packet bundles are received. This is so the bundle headers can be calculated appropriately.");
156156
}
157157

158158
/// <summary>
@@ -186,7 +186,7 @@ internal void AddInboundPacketIdData(PacketId typeSource, string details, int by
186186
{
187187
if (bytes <= 0)
188188
return;
189-
189+
190190
GetBidirectionalNetworkTraffic(asServer).InboundTraffic.AddPacketIdData(typeSource, details, (ulong)bytes, gameObject);
191191
}
192192

Assets/FishNet/Runtime/Plugins/ColliderRollback/Scripts/RollbackManager.cs

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,27 @@ internal void InitializeOnce_Internal(NetworkManager manager)
7878
[Obsolete("Use Rollback(Vector3, Vector3, float, PreciseTick, RollbackPhysicsType.Physics, bool) instead.")] //Remove on V5
7979
public void Rollback(Vector3 origin, Vector3 normalizedDirection, float distance, PreciseTick pt, bool asOwnerAndClientHost = false)
8080
{
81-
82-
}
81+
}
8382

8483
[Obsolete("Use Rollback(Scene, Vector3, Vector3, float, PreciseTick, RollbackPhysicsType.Physics, bool) instead.")] //Remove on V5
8584
public void Rollback(Scene scene, Vector3 origin, Vector3 normalizedDirection, float distance, PreciseTick pt, bool asOwnerAndClientHost = false)
8685
{
87-
88-
}
86+
}
8987

9088
[Obsolete("Use Rollback(int, Vector3, Vector3, float, PreciseTick, RollbackPhysicsType.Physics, bool) instead.")] //Remove on V5
9189
public void Rollback(int sceneHandle, Vector3 origin, Vector3 normalizedDirection, float distance, PreciseTick pt, bool asOwnerAndClientHost = false)
9290
{
93-
94-
}
91+
}
9592

9693
[Obsolete("Use Rollback(Scene, Vector3, Vector3, float, PreciseTick, RollbackPhysicsType.Physics2D, bool) instead.")] //Remove on V5
9794
public void Rollback(Scene scene, Vector2 origin, Vector2 normalizedDirection, float distance, PreciseTick pt, bool asOwnerAndClientHost = false)
9895
{
99-
100-
}
96+
}
10197

10298
[Obsolete("Use Rollback(Vector3, Vector3, float, PreciseTick, RollbackPhysicsType.Physics2D, bool) instead.")] //Remove on V5
10399
public void Rollback(Vector2 origin, Vector2 normalizedDirection, float distance, PreciseTick pt, bool asOwnerAndClientHost = false)
104100
{
105-
106-
}
101+
}
107102

108103
/// <summary>
109104
/// Rolls back all colliders.
@@ -113,8 +108,7 @@ public void Rollback(Vector2 origin, Vector2 normalizedDirection, float distance
113108
/// <param name = "asOwnerAndClientHost">True if IsOwner of the object the raycast is for. This can be ignored and only provides more accurate results for clientHost.</param>
114109
public void Rollback(PreciseTick pt, RollbackPhysicsType physicsType, bool asOwnerAndClientHost = false)
115110
{
116-
117-
}
111+
}
118112

119113
/// <summary>
120114
/// Rolls back all colliders in a scene.
@@ -125,8 +119,7 @@ public void Rollback(PreciseTick pt, RollbackPhysicsType physicsType, bool asOwn
125119
/// <param name = "asOwnerAndClientHost">True if IsOwner of the object the raycast is for. This can be ignored and only provides more accurate results for clientHost.</param>
126120
public void Rollback(Scene scene, PreciseTick pt, RollbackPhysicsType physicsType, bool asOwnerAndClientHost = false)
127121
{
128-
129-
}
122+
}
130123

131124
/// <summary>
132125
/// Rolls back all colliders in a scene.
@@ -137,8 +130,7 @@ public void Rollback(Scene scene, PreciseTick pt, RollbackPhysicsType physicsTyp
137130
/// <param name = "asOwnerAndClientHost">True if IsOwner of the object the raycast is for. This can be ignored and only provides more accurate results for clientHost.</param>
138131
public void Rollback(int sceneHandle, PreciseTick pt, RollbackPhysicsType physicsType, bool asOwnerAndClientHost = false)
139132
{
140-
141-
}
133+
}
142134

143135
/// <summary>
144136
/// Rolls back colliders hit by a test cast against bounding boxes.
@@ -151,8 +143,7 @@ public void Rollback(int sceneHandle, PreciseTick pt, RollbackPhysicsType physic
151143
/// <param name = "asOwnerAndClientHost">True if IsOwner of the object the raycast is for. This can be ignored and only provides more accurate results for clientHost.</param>
152144
public void Rollback(Vector3 origin, Vector3 normalizedDirection, float distance, PreciseTick pt, RollbackPhysicsType physicsType, bool asOwnerAndClientHost = false)
153145
{
154-
155-
}
146+
}
156147

157148
/// <summary>
158149
/// Rolls back colliders hit by a test cast against bounding boxes, in a specific scene.
@@ -166,8 +157,7 @@ public void Rollback(Vector3 origin, Vector3 normalizedDirection, float distance
166157
/// <param name = "asOwnerAndClientHost">True if IsOwner of the object the raycast is for. This can be ignored and only provides more accurate results for clientHost.</param>
167158
public void Rollback(Scene scene, Vector3 origin, Vector3 normalizedDirection, float distance, PreciseTick pt, RollbackPhysicsType physicsType, bool asOwnerAndClientHost = false)
168159
{
169-
170-
}
160+
}
171161

172162
/// <summary>
173163
/// Rolls back colliders hit by a test cast against bounding boxes, in a specific scene.
@@ -181,19 +171,14 @@ public void Rollback(Scene scene, Vector3 origin, Vector3 normalizedDirection, f
181171
/// <param name = "asOwnerAndClientHost">True if IsOwner of the object the raycast is for. This can be ignored and only provides more accurate results for clientHost.</param>
182172
public void Rollback(int sceneHandle, Vector3 origin, Vector3 normalizedDirection, float distance, PreciseTick pt, RollbackPhysicsType physicsType, bool asOwnerAndClientHost = false)
183173
{
184-
185-
}
186-
187-
174+
}
188175

189176
/// <summary>
190177
/// Returns all ColliderRollback objects back to their original position.
191178
/// </summary>
192179
public void Return()
193180
{
194-
195-
}
181+
}
196182

197-
198-
}
183+
}
199184
}

Assets/FishNet/Runtime/Plugins/Yak/Core/ClientSocket.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,15 @@ internal bool StartConnection()
2828
return true;
2929
}
3030

31-
32-
3331
/// <summary>
3432
/// Stops the local socket.
3533
/// </summary>
3634
internal bool StopConnection()
3735
{
38-
3936
return true;
4037
}
4138

42-
43-
44-
45-
46-
47-
4839
#region Local server.
49-
5040
#endregion
5141
}
5242
}

0 commit comments

Comments
 (0)