- fix: set send/recv buffer sizes directly instead of iterating to find the limit.
fixes: https://github.com/MirrorNetworking/Mirror/issues/3390
- fix: server & client sockets are now always non-blocking to ensure main thread never
blocks on socket.recv/send. Send() now also handles WouldBlock.
- fix: socket.Receive/From directly with non-blocking sockets and handle WouldBlock,
instead of socket.Poll. faster, more obvious, and fixes Poll() looping forever while
socket is in error state. fixes: https://github.com/MirrorNetworking/Mirror/issues/2733
* Organize WeaverTypes
- Put all NetworkBehaviors together
- Put Writer with Reader
- Put Remote things together
- moved ScriptableObjectType down
* moved NetworkClientConnectionReference up
We always use a specific reader for NB syncvars, so if a custom defined writer handles data differently this leads to data mismatches.
Supporting custom readers for NB syncvars will just lead to too many edge cases and unexpected behaviour, so dont do it (see https://github.com/MirrorNetworking/Mirror/issues/2680#issuecomment-1435093212 for rationale).
Fixes#2680
* perf: Weave in pre-computed function hash for RPCs
Instead of computing it at runtime for every call
See #3381, #3377 and #3375
* Update Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs
* Update Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs
* Update Assets/Mirror/Editor/Weaver/Processors/TargetRpcProcessor.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
* feat: InterestManagementBase
A interest management base class that allows more advanced interest management by bypassing the built-in HashSet checks via Rebuild overriding
* Update Assets/Mirror/Core/InterestManagementBase.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
This cleanup step prepares for InterestManagement classes being able to customize the rebuild logic, but for that we should move it out of the NetworkServer class
* Interpolation off bools for NetworkTransform.
Gives a snap-like effect to position, rotation and scaling.
* Update Assets/Mirror/Components/NetworkTransformBase.cs
* Update NetworkTransformBase.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
* perf: Use static generic class to cache message id
we can (ab)use c# generics to cache the message id in a static field
this is significantly faster than doing a runtime Dictionary lookup in my testing (16% thread cpu-> ~0.22% for 121 moving nts)
generic classes have separate static fields per type specification, so we can store things per-type there, exactly what we need!
* Obsolete NetworkMessages.GetId
* Update Assets/Mirror/Core/NetworkMessages.cs
* Copy comment from GetId up to the Id field
* wording
---------
Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>
* fix: NetworkWriter - Change MaxStringLength to ushort.MaxValue
- local `realsize` in NetworkReaderExtensions.ReadString changed to ushort with proper casting
- Comments added to NetworkWriterExtensions
- Comments added to NetworkReaderExtensions
- Log output updated in both for consistency
* Added comment
* Changes per request
* feat: Read / Write DateTime
- no UTC conversion...users can do that on their own if they want / need to.
DateTime is a public struct but has no public fields (all properties) so no error is thrown if users try to use it in SyncVar / Cmd / Rpc / NetMsg, but no value is put on the wire and SyncVar hooks don't fire because the client determines no actual value change.
* Added nullable DateTime support
* Removed mysterious using
* Failing generics weaver test for T[]
* fix: weaver doesn't handle generic array field
T[] would cause a NRE:
(0,0): error ----------------------------------------------
(0,0): error Exception :System.NullReferenceException: Object reference not set to an instance of an object.
(0,0): error at Mirror.Weaver.Extensions.IsDerivedFrom(TypeReference tr, Type baseClass) in Mirror\Editor\Weaver\Extensions.cs:line 21
(0,0): error at Mirror.Weaver.Extensions.IsDerivedFrom[T](TypeReference tr) in Mirror\Editor\Weaver\Extensions.cs:line 17
(0,0): error at Mirror.Weaver.SyncObjectProcessor.FindSyncObjectsFields(Writers writers, Readers readers, Logger Log, TypeDefinition td, Boolean& WeavingFailed) in Mirror\Editor\Weaver\Processors\SyncObjectProcessor.cs:line 25
(0,0): error at Mirror.Weaver.NetworkBehaviourProcessor.Process(Boolean& WeavingFailed) in Mirror\Editor\Weaver\Processors\NetworkBehaviourProcessor.cs:line 76
(0,0): error at Mirror.Weaver.Weaver.WeaveNetworkBehavior(TypeDefinition td) in Mirror\Editor\Weaver\Weaver.cs:line 109
(0,0): error at Mirror.Weaver.Weaver.WeaveModule(ModuleDefinition moduleDefinition) in Mirror\Editor\Weaver\Weaver.cs:line 125
(0,0): error at Mirror.Weaver.Weaver.Weave(AssemblyDefinition assembly, IAssemblyResolver resolver, Boolean& modified) in Mirror\Editor\Weaver\Weaver.cs:line 208
(0,0): error ----------------------------------------------