Skip to content

Commit 8515c8b

Browse files
author
FirstGearGames
committed
4.6.10
- Fixed ServerManager automatically starting the server 'as headless' when in editor under server build target. - Fixed errors when destroying a scene NetworkObject on the server as the scene loaded (#922). - Fixed nested scene NetworkObjects spawning while the parent was despawned (#919). - Fixed NetworkCollider invoking OnEnter/Exit excessively (#915). - Fixed duplicate SyncList entries when adding entries via OnStartServer from a different script (#913). - Fixed NonSerialized attribute preventing network serialization on fields; use ExcludeSerialization (#935). - Fixed harmless 'entry already added' error when calling SetParent after TakeOwnership on host (#906). - Fixed unable to set SyncVar values before calling Spawn when action is done on a previously pooled object (#911). - Fixed RPC user logic improperly calling top-most methods when calling overriden methods (#938). - Fixed TimeManager.LowFrameRate returning an incorrect value (#934). - Fixed DefaultPrefabObjects prefabs becoming null after editing them on Unity Multiplayer (#916). - Added HashSet serialization support (#917). - Added property sensitivity settings to NetworkTransform. - Improved NetworkCollider2D made significantly more efficient by updating to NetworkCollider template. - Improved types which codegen detects as non-serializable will now have their encapsulating types displayed (#920). - Improved generated prefabs list is now ordered by asset path (#926). - Changed Beta SyncTypes moved to Stable.
1 parent 19ce1ee commit 8515c8b

File tree

673 files changed

+42104
-48130
lines changed

Some content is hidden

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

673 files changed

+42104
-48130
lines changed

Assets/FishNet/CodeGenerating/Extension/FieldDefinitionExtensions.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
namespace FishNet.CodeGenerating.Helping.Extension
44
{
5-
65
internal static class FieldDefinitionExtensions
76
{
8-
97
/// <summary>
108
/// Makes a FieldDefinition generic if it has generic parameters.
119
/// </summary>
@@ -14,9 +12,5 @@ public static FieldReference TryMakeGenericInstance(this FieldDefinition fd, Cod
1412
FieldReference fr = session.ImportReference(fd);
1513
return fr.TryMakeGenericInstance();
1614
}
17-
18-
19-
2015
}
21-
2216
}

Assets/FishNet/CodeGenerating/Extension/FieldReferenceExtensions.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33

44
namespace FishNet.CodeGenerating.Helping.Extension
55
{
6-
76
internal static class FieldReferenceExtensions
87
{
9-
108
/// <summary>
119
/// Gets a Resolve favoring cached results first.
1210
/// </summary>
@@ -33,8 +31,5 @@ public static FieldReference TryMakeGenericInstance(this FieldReference fr)
3331
return fr;
3432
}
3533
}
36-
37-
3834
}
39-
4035
}

Assets/FishNet/CodeGenerating/Extension/ILProcessorExtensions.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
namespace FishNet.CodeGenerating.Extension
66
{
7-
8-
97
internal static class ILProcessorExtensions
108
{
119
/// <summary>
@@ -15,6 +13,7 @@ internal static VariableDefinition CreateVariable(this ILProcessor processor, Co
1513
{
1614
return processor.Body.Method.CreateVariable(session, variableType);
1715
}
16+
1817
/// <summary>
1918
/// Creates a variable type within the body and returns it's VariableDef.
2019
/// </summary>
@@ -23,6 +22,4 @@ internal static VariableDefinition CreateVariable(this ILProcessor processor, Co
2322
return processor.Body.Method.CreateVariable(variableTr);
2423
}
2524
}
26-
27-
2825
}

Assets/FishNet/CodeGenerating/Extension/MethodDefinitionExtensions.cs

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66

77
namespace FishNet.CodeGenerating.Extension
88
{
9-
10-
119
internal static class MethodDefinitionExtensions
1210
{
13-
public const MethodAttributes PUBLIC_VIRTUAL_ATTRIBUTES = (MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig);
14-
public const MethodAttributes PROTECTED_VIRTUAL_ATTRIBUTES = (MethodAttributes.Family | MethodAttributes.Virtual | MethodAttributes.HideBySig);
11+
public const MethodAttributes PUBLIC_VIRTUAL_ATTRIBUTES = MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig;
12+
public const MethodAttributes PROTECTED_VIRTUAL_ATTRIBUTES = MethodAttributes.Family | MethodAttributes.Virtual | MethodAttributes.HideBySig;
1513

1614
/// <summary>
1715
/// Returns a custom attribute.
@@ -27,7 +25,7 @@ public static CustomAttribute GetCustomAttribute(this MethodDefinition md, strin
2725
return item;
2826
}
2927

30-
//Not found.
28+
// Not found.
3129
return null;
3230
}
3331

@@ -44,19 +42,18 @@ internal static void ClearMethodWithRet(this MethodDefinition md, CodegenSession
4442
/// <summary>
4543
/// Returns the ParameterDefinition index from end of parameters.
4644
/// </summary>
47-
/// <param name="md"></param>
48-
/// <param name="index"></param>
45+
/// <param name = "md"></param>
46+
/// <param name = "index"></param>
4947
/// <returns></returns>
5048
internal static ParameterDefinition GetEndParameter(this MethodDefinition md, int index)
5149
{
52-
//Not enough parameters.
53-
if (md.Parameters.Count < (index + 1))
50+
// Not enough parameters.
51+
if (md.Parameters.Count < index + 1)
5452
return null;
5553

5654
return md.Parameters[md.Parameters.Count - (index + 1)];
5755
}
5856

59-
6057
/// <summary>
6158
/// Creates a variable type within the body and returns it's VariableDef.
6259
/// </summary>
@@ -78,17 +75,18 @@ internal static VariableDefinition CreateVariable(this MethodDefinition methodDe
7875
/// <summary>
7976
/// Returns the proper OpCode to use for call methods.
8077
/// </summary>
81-
public static MonoFN.Cecil.Cil.OpCode GetCallOpCode(this MethodDefinition md)
78+
public static OpCode GetCallOpCode(this MethodDefinition md)
8279
{
8380
if (md.Attributes.HasFlag(MethodAttributes.Virtual))
84-
return MonoFN.Cecil.Cil.OpCodes.Callvirt;
81+
return OpCodes.Callvirt;
8582
else
86-
return MonoFN.Cecil.Cil.OpCodes.Call;
83+
return OpCodes.Call;
8784
}
85+
8886
/// <summary>
8987
/// Returns the proper OpCode to use for call methods.
9088
/// </summary>
91-
public static MonoFN.Cecil.Cil.OpCode GetCallOpCode(this MethodReference mr, CodegenSession session)
89+
public static OpCode GetCallOpCode(this MethodReference mr, CodegenSession session)
9290
{
9391
return mr.CachedResolve(session).GetCallOpCode();
9492
}
@@ -115,9 +113,9 @@ public static List<ParameterDefinition> CreateParameters(this MethodDefinition t
115113
{
116114
session.ImportReference(pd.ParameterType.CachedResolve(session));
117115
int currentCount = thisMd.Parameters.Count;
118-
string name = (pd.Name + currentCount);
116+
string name = pd.Name + currentCount;
119117
ParameterDefinition parameterDef = new(name, pd.Attributes, pd.ParameterType);
120-
//Set any default values.
118+
// Set any default values.
121119
parameterDef.Constant = pd.Constant;
122120
parameterDef.IsReturnValue = pd.IsReturnValue;
123121
parameterDef.IsOut = pd.IsOut;
@@ -147,7 +145,7 @@ public static MethodReference GetMethodReference(this MethodDefinition md, Codeg
147145
{
148146
MethodReference methodRef = session.ImportReference(md);
149147

150-
//Is generic.
148+
// Is generic.
151149
if (md.DeclaringType.HasGenericParameters)
152150
{
153151
GenericInstanceType git = methodRef.DeclaringType.MakeGenericInstanceType();
@@ -156,7 +154,7 @@ public static MethodReference GetMethodReference(this MethodDefinition md, Codeg
156154
HasThis = md.HasThis,
157155
ExplicitThis = md.ExplicitThis,
158156
DeclaringType = git,
159-
CallingConvention = md.CallingConvention,
157+
CallingConvention = md.CallingConvention
160158
};
161159
foreach (ParameterDefinition pd in md.Parameters)
162160
{
@@ -171,7 +169,6 @@ public static MethodReference GetMethodReference(this MethodDefinition md, Codeg
171169
}
172170
}
173171

174-
175172
/// <summary>
176173
/// Returns a method reference for a generic method.
177174
/// </summary>
@@ -198,7 +195,6 @@ internal static bool RemoveEndRet(this MethodDefinition md, CodegenSession sessi
198195
}
199196
}
200197

201-
202198
/// <summary>
203199
/// Returns a method reference for a generic method.
204200
/// </summary>
@@ -211,9 +207,9 @@ public static MethodReference GetMethodReference(this MethodDefinition md, Codeg
211207
public static MethodDefinition CreateCopy(this MethodDefinition copiedMd, CodegenSession session, string nameOverride = null, MethodAttributes? attributesOverride = null)
212208
{
213209
session.ImportReference(copiedMd.ReturnType);
214-
215-
MethodAttributes attr = (attributesOverride.HasValue) ? attributesOverride.Value : copiedMd.Attributes;
216-
string name = (nameOverride == null) ? copiedMd.Name : nameOverride;
210+
211+
MethodAttributes attr = attributesOverride.HasValue ? attributesOverride.Value : copiedMd.Attributes;
212+
string name = nameOverride == null ? copiedMd.Name : nameOverride;
217213
MethodDefinition result = new(name, attr, copiedMd.ReturnType);
218214
foreach (GenericParameter item in copiedMd.GenericParameters)
219215
result.GenericParameters.Add(item);
@@ -229,11 +225,10 @@ public static void SetPublicAttributes(this MethodDefinition md)
229225
{
230226
md.Attributes = PUBLIC_VIRTUAL_ATTRIBUTES;
231227
}
228+
232229
public static void SetProtectedAttributes(this MethodDefinition md)
233230
{
234231
md.Attributes = PROTECTED_VIRTUAL_ATTRIBUTES;
235232
}
236233
}
237-
238-
239234
}

Assets/FishNet/CodeGenerating/Extension/TypeDefinitionExtensions.cs

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,21 @@
66

77
namespace FishNet.CodeGenerating.Extension
88
{
9-
10-
119
internal static class TypeDefinitionExtensions
1210
{
13-
14-
1511
/// <summary>
1612
/// Returns if a TypeDefinition is nullable.
1713
/// </summary>
1814
public static bool IsNullable(this TypeDefinition td)
1915
{
20-
return (td.Name == typeof(System.Nullable<>).Name);
16+
return td.Name == typeof(System.Nullable<>).Name;
2117
}
2218

2319
/// <summary>
2420
/// Finds the first method by a given name.
2521
/// </summary>
26-
/// <param name="typeDef"></param>
27-
/// <param name="methodName"></param>
22+
/// <param name = "typeDef"></param>
23+
/// <param name = "methodName"></param>
2824
/// <returns></returns>
2925
internal static MethodDefinition GetMethod(this TypeDefinition typeDef, string methodName)
3026
{
@@ -37,7 +33,6 @@ internal static MethodDefinition GetMethod(this TypeDefinition typeDef, string m
3733
return null;
3834
}
3935

40-
4136
public static MethodReference GetMethodReferenceInBase(this TypeDefinition td, CodegenSession session, string methodName)
4237
{
4338
MethodDefinition baseMd = td.GetMethodDefinitionInBase(session, methodName);
@@ -53,7 +48,7 @@ public static MethodReference GetMethodReferenceInBase(this TypeDefinition td, C
5348
{
5449
HasThis = baseMd.HasThis,
5550
CallingConvention = baseMd.CallingConvention,
56-
ExplicitThis = baseMd.ExplicitThis,
51+
ExplicitThis = baseMd.ExplicitThis
5752
};
5853
foreach (ParameterDefinition pd in baseMd.Parameters)
5954
{
@@ -68,6 +63,7 @@ public static MethodReference GetMethodReferenceInBase(this TypeDefinition td, C
6863

6964
return baseMr;
7065
}
66+
7167
/// <summary>
7268
/// Returns a method in the next base class.
7369
/// </summary>
@@ -83,14 +79,13 @@ public static MethodDefinition GetMethodDefinitionInBase(this TypeDefinition td,
8379
return baseTd.GetMethod(methodName);
8480
}
8581

86-
8782
/// <summary>
8883
/// Returns a method in the next base class.
8984
/// </summary>
9085
public static MethodReference GetMethodReference(this TypeDefinition td, CodegenSession session, string methodName)
9186
{
9287
MethodDefinition md = td.GetMethod(methodName);
93-
//Not found.
88+
// Not found.
9489
if (md == null)
9590
return null;
9691

@@ -103,7 +98,7 @@ public static MethodReference GetMethodReference(this TypeDefinition td, Codegen
10398
public static MethodReference GetOrCreateMethodReference(this TypeDefinition td, CodegenSession session, string methodName, MethodAttributes attributes, TypeReference returnType, out bool created)
10499
{
105100
MethodDefinition md = td.GetMethod(methodName);
106-
//Not found.
101+
// Not found.
107102
if (md == null)
108103
{
109104
md = new(methodName, attributes, returnType);
@@ -118,7 +113,6 @@ public static MethodReference GetOrCreateMethodReference(this TypeDefinition td,
118113
return md.GetMethodReference(session);
119114
}
120115

121-
122116
/// <summary>
123117
/// Gets a MethodDefinition or creates one if missing.
124118
/// </summary>
@@ -156,7 +150,7 @@ public static MethodDefinition GetOrCreateMethodDefinition(this TypeDefinition t
156150
AggressiveInlining = methodTemplate.AggressiveInlining,
157151
Attributes = methodTemplate.Attributes,
158152
CallingConvention = methodTemplate.CallingConvention,
159-
HasThis = methodTemplate.HasThis,
153+
HasThis = methodTemplate.HasThis
160154
};
161155
md.Body.InitLocals = methodTemplate.Body.InitLocals;
162156

@@ -186,8 +180,6 @@ public static MethodDefinition GetOrCreateMethodDefinition(this TypeDefinition t
186180
return md;
187181
}
188182

189-
190-
191183
/// <summary>
192184
/// Returns a method in any inherited classes. The first found method is returned.
193185
/// </summary>
@@ -217,7 +209,7 @@ public static MethodDefinition GetMethodDefinitionInAnyBase(this TypeDefinition
217209
/// <summary>
218210
/// Returns a TypeDefintiion found in typeDef or up it's hierarchy.
219211
/// </summary>
220-
/// <param name="checkTypeDef">True to check if typeDef equals fullName.</param>
212+
/// <param name = "checkTypeDef">True to check if typeDef equals fullName.</param>
221213
/// <returns></returns>
222214
public static TypeDefinition GetTypeDefinitionInBase(this TypeDefinition typeDef, CodegenSession session, string targetFullName, bool checkTypeDef)
223215
{
@@ -242,7 +234,7 @@ public static TypeDefinition GetTypeDefinitionInBase(this TypeDefinition typeDef
242234
/// </summary>
243235
public static TypeDefinition GetNextBaseTypeDefinition(this TypeDefinition typeDef, CodegenSession session)
244236
{
245-
return (typeDef.BaseType == null) ? null : typeDef.BaseType.CachedResolve(session);
237+
return typeDef.BaseType == null ? null : typeDef.BaseType.CachedResolve(session);
246238
}
247239

248240
/// <summary>
@@ -297,7 +289,6 @@ public static FieldReference CreateFieldDefinition(this TypeDefinition td, Codeg
297289
return fd.CreateFieldReference(session);
298290
}
299291

300-
301292
/// <summary>
302293
/// Makes a GenericInstanceType.
303294
/// </summary>
@@ -306,9 +297,5 @@ public static GenericInstanceType MakeGenericInstanceType(this TypeDefinition se
306297
TypeReference tr = session.ImportReference(self);
307298
return tr.MakeGenericInstanceType();
308299
}
309-
310-
311300
}
312-
313-
314301
}

0 commit comments

Comments
 (0)