Skip to content

Commit de19b5d

Browse files
author
FIrstGearGames
committed
4.7.2
- Fixed NetworkTickSmoother.FavorNetworkTransform missing from the inspector. - Fixed garbage collection in NetworkCollider/2D on server/host. - Fixed garbage collection ObjectCaching due to ConcurrentStack internal collections being discarded. - Changed removed threading Tugboat socket start/stop to support ObjectCaching changes. - Changed: Use new() over new Explicit(). - Added BETA Synapse Transport/Socket: 5a01d2640255d31db51d595ab3a5a8eab8ee769a
1 parent 144a689 commit de19b5d

279 files changed

Lines changed: 13012 additions & 1327 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/FishNet/CodeGenerating/Helpers/NetworkBehaviourHelper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ internal void CreateReplicateDelegate(MethodDefinition originalMethodDef, Method
213213
/// <param name = "rpcType"></param>
214214
internal void CreateRpcDelegate(bool runLocally, TypeDefinition typeDef, MethodDefinition readerMethodDef, RpcType rpcType, uint methodHash, CustomAttribute rpcAttribute)
215215
{
216+
216217
MethodDefinition methodDef = typeDef.GetMethod(NetworkBehaviourProcessor.NETWORKINITIALIZE_EARLY_INTERNAL_NAME);
217218
ILProcessor processor = methodDef.Body.GetILProcessor();
218219

Assets/FishNet/CodeGenerating/ILCore/FishNetILPP.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public override ILPostProcessResult Process(ICompiledAssembly compiledAssembly)
6262
if (!session.Initialize(assemblyDef.MainModule))
6363
return null;
6464

65+
6566
bool modified = false;
6667

6768
bool fnAssembly = IsFishNetAssembly(compiledAssembly);
@@ -333,6 +334,7 @@ private bool CreateQOLAttributes(CodegenSession session)
333334
modified |= session.GetClass<QolAttributeProcessor>().Process(td, codeStripping);
334335
}
335336

337+
336338
return modified;
337339
}
338340

Assets/FishNet/CodeGenerating/Processing/NetworkBehaviourProcessor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ internal bool ProcessLocal(TypeDefinition typeDef)
7878
CreateNetworkInitializeMethods(td, out networkInitializeIfDisabledMd);
7979
CallNetworkInitialize(networkInitializeIfDisabledMd);
8080

81+
8182
/* Prediction. */
8283
/* Run prediction first since prediction will modify
8384
* user data passed into prediction methods. Because of this
@@ -194,6 +195,7 @@ internal bool NonNetworkBehaviourHasInvalidAttributes(Collection<TypeDefinition>
194195
return false;
195196
}
196197

198+
197199
/// <summary>
198200
/// Calls the next awake method if the nested awake was created by codegen.
199201
/// </summary>

Assets/FishNet/CodeGenerating/Processing/QOLAttributeProcessor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ internal bool Process(TypeDefinition typeDef, bool moveStrippedCalls)
1818
bool modified = false;
1919
List<MethodDefinition> methods = typeDef.Methods.ToList();
2020

21+
2122
foreach (MethodDefinition md in methods)
2223
{
2324
// Has RPC attribute, doesn't quality for a quality of life attribute.
@@ -152,10 +153,11 @@ private void CreateAttributeMethod(MethodDefinition methodDef, CustomAttribute q
152153

153154
bool StripMethod(MethodDefinition md)
154155
{
156+
155157
// Fall through.
156158
return false;
157159
}
158160
}
159161

160-
}
162+
}
161163
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ private MethodDefinition CreateRpcWriterMethod(List<ParameterDefinition> seriali
257257
{
258258
intentionallyNull = false;
259259

260+
260261
string methodName = $"{WRITER_PREFIX}{GetRpcMethodName(cr)}";
261262
/* If method already exist then clear it. This
262263
* can occur when a method needs to be rebuilt due to
@@ -363,7 +364,7 @@ private bool CreateClientRpcWriterMethod(List<ParameterDefinition> serializedPar
363364
/* Creates basic ServerRpc and ClientRpc
364365
* conditions such as if requireOwnership ect..
365366
* or if (!base.isClient) */
366-
CreateClientRpcConditionsForServer(writerMd, cr.Attribute);
367+
CreateClientRpcConditionsForServer(writerMd, cr.Attribute);
367368

368369
VariableDefinition channelVariableDef = CreateAndPopulateChannelVariable(writerMd, channelParameterDef);
369370
/* Create a local PooledWriter variable. */
@@ -420,7 +421,7 @@ private bool CreateServerRpcWriterMethod(List<ParameterDefinition> serializedPar
420421
/* Creates basic ServerRpc
421422
* conditions such as if requireOwnership ect..
422423
* or if (!base.isClient) */
423-
CreateServerRpcConditionsForClient(writerMd, cr.Attribute);
424+
CreateServerRpcConditionsForClient(writerMd, cr.Attribute);
424425

425426
VariableDefinition channelVariableDef = CreateAndPopulateChannelVariable(writerMd, channelParameterDef);
426427
// Create a local PooledWriter variable.
@@ -484,6 +485,7 @@ private MethodDefinition CreateRpcReaderMethod(List<ParameterDefinition> seriali
484485
MethodDefinition logicMd = cr.LogicMethodDef;
485486
CustomAttribute rpcAttribute = cr.Attribute;
486487

488+
487489
string methodName = $"{READER_PREFIX}{GetRpcMethodName(cr)}";
488490
/* If method already exist then just return it. This
489491
* can occur when a method needs to be rebuilt due to
@@ -854,6 +856,7 @@ private MethodDefinition CreateRpcLogicMethod(List<AttributeData> datas, Created
854856
TypeDefinition typeDef = cr.TypeDef;
855857
MethodDefinition originalMd = cr.OriginalMethodDef;
856858

859+
857860
//Methodname for logic methods do not use prefixes because there can be only one.
858861
string methodName = $"{LOGIC_PREFIX}{GetMethodNameAsParameters(originalMd)}";
859862

@@ -966,6 +969,7 @@ private void RedirectOriginalToWriter(List<CreatedRpc> createdRpcs)
966969
* entry. */
967970
MethodDefinition originalMd = createdRpcs[0].OriginalMethodDef;
968971

972+
969973
ILProcessor processor = originalMd.Body.GetILProcessor();
970974
originalMd.Body.Instructions.Clear();
971975

Assets/FishNet/Demos/ColliderRollback/Scripts/Player/Fire.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ namespace FishNet.Example.ColliderRollbacks
1313
/// </summary>
1414
public class Fire : NetworkBehaviour
1515
{
16-
}
16+
}
1717
}

Assets/FishNet/Demos/Prediction/Rigidbody/Rigidbody Prediction Demo.unity

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ MonoBehaviour:
155155
m_EditorClassIdentifier:
156156
_color: {r: 1, g: 1, b: 1, a: 1}
157157
_placement: 1
158-
_hideTickRate: 1
158+
_hideTickRate: 0
159159
--- !u!114 &192429409
160160
MonoBehaviour:
161161
m_ObjectHideFlags: 0
@@ -237,6 +237,9 @@ MonoBehaviour:
237237
_preventDespawnOnDisconnect: 0
238238
_defaultDespawnType: 0
239239
_initializedTimestamp: 0
240+
_localLevelOfDetailCalculationType: 0
241+
_useLevelOfDetail: 0
242+
_useRootLevelOfDetail: 1
240243
NetworkObserver: {fileID: 0}
241244
_enablePrediction: 0
242245
_predictionType: 0
@@ -927,6 +930,9 @@ MonoBehaviour:
927930
_preventDespawnOnDisconnect: 0
928931
_defaultDespawnType: 0
929932
_initializedTimestamp: 0
933+
_localLevelOfDetailCalculationType: 0
934+
_useLevelOfDetail: 0
935+
_useRootLevelOfDetail: 1
930936
NetworkObserver: {fileID: 0}
931937
_enablePrediction: 0
932938
_predictionType: 0
@@ -1300,6 +1306,7 @@ GameObject:
13001306
- component: {fileID: 7443408886491487336}
13011307
- component: {fileID: 7443408886491487337}
13021308
- component: {fileID: 7443408886491487338}
1309+
- component: {fileID: 7443408886491487339}
13031310
m_Layer: 0
13041311
m_Name: NetworkManager
13051312
m_TagString: Untagged
@@ -1377,3 +1384,24 @@ MonoBehaviour:
13771384
_enableMode: 1
13781385
_updateClient: 1
13791386
_updateServer: 1
1387+
--- !u!114 &7443408886491487339
1388+
MonoBehaviour:
1389+
m_ObjectHideFlags: 0
1390+
m_CorrespondingSourceObject: {fileID: 0}
1391+
m_PrefabInstance: {fileID: 0}
1392+
m_PrefabAsset: {fileID: 0}
1393+
m_GameObject: {fileID: 7443408886491487334}
1394+
m_Enabled: 1
1395+
m_EditorHideFlags: 0
1396+
m_Script: {fileID: 11500000, guid: 6f48f002b825cbd45a19bd96d90f9edb, type: 3}
1397+
m_Name:
1398+
m_EditorClassIdentifier:
1399+
_stopSocketsOnThread: 0
1400+
_dontRoute: 0
1401+
_reuseAddress: 0
1402+
_ipv4BindAddress:
1403+
_enableIpv6: 1
1404+
_ipv6BindAddress:
1405+
_port: 7770
1406+
_maximumClients: 4095
1407+
_clientAddress: localhost

Assets/FishNet/Demos/Scripts/NetworkHudCanvases.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ string GetNextStateText(LocalConnectionState state)
9999
return "Invalid";
100100
}
101101

102-
GUILayout.BeginArea(new Rect(4, 110, 256, 9000));
103-
Vector2 defaultResolution = new Vector2(1920f, 1080f);
104-
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(Screen.width / defaultResolution.x, Screen.height / defaultResolution.y, 1));
102+
GUILayout.BeginArea(new(4, 110, 256, 9000));
103+
Vector2 defaultResolution = new(1920f, 1080f);
104+
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new(Screen.width / defaultResolution.x, Screen.height / defaultResolution.y, 1));
105105

106106
GUIStyle style = GUI.skin.GetStyle("button");
107107
int originalFontSize = style.fontSize;
108108

109-
Vector2 buttonSize = new Vector2(165f, 42f);
109+
Vector2 buttonSize = new(165f, 42f);
110110
style.fontSize = 26;
111111
// Server button.
112112
if (Application.platform != RuntimePlatform.WebGLPlayer)

Assets/FishNet/Runtime/Editor/CodeStripping.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace FishNet.Configuring
1313
{
1414
public class CodeStripping
15-
{
15+
{
1616
/// <summary>
1717
/// True if making a release build for client.
1818
/// </summary>
@@ -29,6 +29,7 @@ public static bool RemoveServerLogic
2929
{
3030
get
3131
{
32+
3233
/* This is to protect non pro users from enabling this
3334
* without the extra logic code. */
3435
#pragma warning disable CS0162 // Unreachable code detected
@@ -43,6 +44,7 @@ public static bool StripBuild
4344
{
4445
get
4546
{
47+
4648
/* This is to protect non pro users from enabling this
4749
* without the extra logic code. */
4850
#pragma warning disable CS0162 // Unreachable code detected
@@ -64,7 +66,7 @@ public void OnPreprocessBuild(BuildReport report)
6466
CompilationPipeline.compilationStarted += CompilationPipelineOnCompilationStarted;
6567
CompilationPipeline.compilationFinished += CompilationPipelineOnCompilationFinished;
6668

67-
}
69+
}
6870

6971
/* Solution for builds ending with errors and not triggering OnPostprocessBuild.
7072
* Link: https://gamedev.stackexchange.com/questions/181611/custom-build-failure-callback
@@ -89,12 +91,13 @@ private void CompilationPipelineOnCompilationFinished(object compilationContext)
8991

9092
private void BuildingEnded()
9193
{
94+
9295
Generator.IgnorePostProcess = false;
9396
}
9497

9598
public void OnPostprocessBuild(BuildReport report)
9699
{
97-
BuildingEnded();
100+
BuildingEnded();
98101
}
99102
}
100103
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
//

0 commit comments

Comments
 (0)