Skip to content

Commit cd61ea3

Browse files
author
FirstGearGames
committed
4.6.16R
- Fixed Server/ClientAttribute not blocking execution when IsNetworked was set to false (#939). - Improved added a variety of ProfilerMarkers (#976). - Improved NetworkManager.RunInBackground now only applies when the network is active (#954). - Fixed specified prefab folders incorrectly checking for overlapping recrusion (#986). - Fixed DefaultPrefabObjects inconsistent asset paths related to culture specific strings (#982). - Fixed Collection/Object caches mishandling multithreading; introduced in Unity 6+ (#984). - Fixed NetworkObjects initializing excessively at runtime during instantiate and scene loads. - Fixed SyncType values not resetting on client when using pooled objects. - Fixed despawned nested NetworkObjects serializing incorrectly (#950). - Fixed pooled objects sometimes having the incorrect position upon spawning after the first time. (#949). - Fixed rollback time calculation for client-only when user-logic incorrectly identified as host. - Fixed StatisticsManager and BandwidthDisplay reporting incorrectly. - Changed local transports no longer automatically authenticate when an authenticator is present; authenticators should now handle local transports/connections. See HostAuthenticator and PasswordAuthenticator example. - Improved renamed several files related to code generation to prevent conflicts with NGO. - Improved PasswordAuthenticator example and comments. - Improved HostAuthenticator comments and usage. - Added QuaternionAutoPack to allow easy Quaterion packing levels for types, such as reconcile rotation data. - Added MovePosition/MoveRotation to PredictionRigidbody/2D. - Added rotationPacking option to PredictionRigidbody/2D.
1 parent 0a76285 commit cd61ea3

File tree

57 files changed

+990
-1386
lines changed

Some content is hidden

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

57 files changed

+990
-1386
lines changed

Assets/FishNet/CodeGenerating/Helpers/NetworkBehaviourHelper.cs

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,13 @@ internal void CreateIsClientCheck(MethodDefinition methodDef, LoggingType loggin
331331
* Should the if check pass then code
332332
* jumps to this instruction. */
333333
ILProcessor processor = methodDef.Body.GetILProcessor();
334-
Instruction endIf = processor.Create(OpCodes.Nop);
334+
Instruction conditionFailedInst = processor.Create(OpCodes.Nop);
335+
Instruction conditionPassedInst = processor.Create(OpCodes.Nop);
335336

336337
List<Instruction> instructions = new();
337338

338339
if (checkIsNetworked)
339-
instructions.AddRange(CreateIsNetworkedCheck(methodDef, endIf));
340+
instructions.AddRange(CreateIsNetworkedCheck(methodDef, OpCodes.Brtrue, conditionPassedInst));
340341

341342
// Checking against the NetworkObject.
342343
if (!useStatic)
@@ -350,7 +351,10 @@ internal void CreateIsClientCheck(MethodDefinition methodDef, LoggingType loggin
350351
{
351352
instructions.Add(processor.Create(OpCodes.Call, GetClass<ObjectHelper>().InstanceFinder_IsClient_MethodRef));
352353
}
353-
instructions.Add(processor.Create(OpCodes.Brtrue, endIf));
354+
355+
instructions.Add(processor.Create(OpCodes.Brtrue, conditionPassedInst));
356+
instructions.Add(conditionFailedInst);
357+
354358
// If warning then also append warning text.
355359
if (loggingType != LoggingType.Off)
356360
{
@@ -360,7 +364,7 @@ internal void CreateIsClientCheck(MethodDefinition methodDef, LoggingType loggin
360364
// Add return.
361365
instructions.AddRange(CreateRetDefault(methodDef));
362366
// After if statement, jumped to when successful check.
363-
instructions.Add(endIf);
367+
instructions.Add(conditionPassedInst);
364368

365369
if (insertFirst)
366370
{
@@ -383,12 +387,13 @@ internal void CreateIsServerCheck(MethodDefinition methodDef, LoggingType loggin
383387
* Should the if check pass then code
384388
* jumps to this instruction. */
385389
ILProcessor processor = methodDef.Body.GetILProcessor();
386-
Instruction endIf = processor.Create(OpCodes.Nop);
390+
Instruction conditionFailedInst = processor.Create(OpCodes.Nop);
391+
Instruction conditionPassedInst = processor.Create(OpCodes.Nop);
387392

388393
List<Instruction> instructions = new();
389394

390395
if (checkIsNetworked)
391-
instructions.AddRange(CreateIsNetworkedCheck(methodDef, endIf));
396+
instructions.AddRange(CreateIsNetworkedCheck(methodDef, OpCodes.Brfalse, conditionFailedInst));
392397

393398
if (!useStatic)
394399
{
@@ -401,7 +406,10 @@ internal void CreateIsServerCheck(MethodDefinition methodDef, LoggingType loggin
401406
{
402407
instructions.Add(processor.Create(OpCodes.Call, GetClass<ObjectHelper>().InstanceFinder_IsServer_MethodRef));
403408
}
404-
instructions.Add(processor.Create(OpCodes.Brtrue, endIf));
409+
410+
instructions.Add(processor.Create(OpCodes.Brtrue, conditionPassedInst));
411+
instructions.Add(conditionFailedInst);
412+
405413
// If warning then also append warning text.
406414
if (loggingType != LoggingType.Off)
407415
{
@@ -411,7 +419,7 @@ internal void CreateIsServerCheck(MethodDefinition methodDef, LoggingType loggin
411419
// Add return.
412420
instructions.AddRange(CreateRetDefault(methodDef));
413421
// After if statement, jumped to when successful check.
414-
instructions.Add(endIf);
422+
instructions.Add(conditionPassedInst);
415423

416424
if (insertFirst)
417425
{
@@ -427,13 +435,19 @@ internal void CreateIsServerCheck(MethodDefinition methodDef, LoggingType loggin
427435
/// <summary>
428436
/// Creates a call to base.IsNetworked and returns instructions.
429437
/// </summary>
430-
private List<Instruction> CreateIsNetworkedCheck(MethodDefinition methodDef, Instruction endIfInst)
438+
private List<Instruction> CreateIsNetworkedCheck(MethodDefinition methodDef, OpCode conditionalOpCode, Instruction endIfInst)
431439
{
440+
if (conditionalOpCode != OpCodes.Brfalse && conditionalOpCode != OpCodes.Brtrue && conditionalOpCode != OpCodes.Brfalse_S && conditionalOpCode != OpCodes.Brtrue_S)
441+
{
442+
Session.LogError($"OpCode {conditionalOpCode} is not supported for method {nameof(CreateIsNetworkedCheck)}.");
443+
return new();
444+
}
445+
432446
List<Instruction> insts = new();
433447
ILProcessor processor = methodDef.Body.GetILProcessor();
434448
insts.Add(processor.Create(OpCodes.Ldarg_0));
435449
insts.Add(processor.Create(OpCodes.Call, GetClass<NetworkBehaviourHelper>().IsNetworked_MethodRef));
436-
insts.Add(processor.Create(OpCodes.Brfalse, endIfInst));
450+
insts.Add(processor.Create(conditionalOpCode, endIfInst));
437451

438452
return insts;
439453
}

Assets/FishNet/CodeGenerating/ILCore/FNPostProcessorAssemblyResolver.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FishNet/CodeGenerating/ILCore/FNPostProcessorReflectionImporter.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FishNet/CodeGenerating/ILCore/FNPostProcessorReflectionImporterProvider.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/FishNet/CodeGenerating/ILCore/PostProcessorAssemblyResolver.cs

Lines changed: 0 additions & 134 deletions
This file was deleted.

Assets/FishNet/CodeGenerating/ILCore/PostProcessorAssemblyResolver.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Assets/FishNet/CodeGenerating/ILCore/PostProcessorReflectionImporter.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

Assets/FishNet/CodeGenerating/ILCore/PostProcessorReflectionImporter.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Assets/FishNet/CodeGenerating/ILCore/PostProcessorReflectionImporterProvider.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

Assets/FishNet/CodeGenerating/ILCore/PostProcessorReflectionImporterProvider.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)