* feat: Disconnect Dead Clients
* Moved code to NetworkConnectionToClient
* Fixed type
* WIP
* Trying to solve the mystery of the Host
* Updated Example
* fixed comment whitespace
* Final Cleanup and Unit Test
* Removed extra warning
* Reverted change to scene file
* Changed to Play test, still not working
* Added NetworkServer.Update time loop
* Removed commented code
* fixed comment
* Filled in ServerDisconnect so it behaves as expected.
* fixed comment
* Renamed to bool IsClientAlive
* Should be greater than
* Added override that shouldn't be necessary.
* changed asserts per Paul
* Flipped < back
* Shortened test time
* Corrected comment
* Lost the 1
* Updated NetworkServerTest
* Update Assets/Mirror/Tests/Runtime/NetworkServerTest.cs
* Added bool checkInactiveConnections
* Tests for sync dictionary and sync set (#1753)
* sync dictionary tests
* rename
* changing error message
* sync set tests
* silence unused method warning
* test class name matches file name
* test class name matches file name
* test class name matches file name
* test class name matches file name
* test class name matches file name
* test class name matches file name
* test class name matches file name
* Scope syncdict tests to their classes
* Scope synclists tests to their classes
* Scope syncset tests to their classes
* test class name matches file name
* Scope sample classes
* test class name matches file name
* fix: call the virtual OnRoomServerDisconnect before the base
* fixed name
* doc: Updated docs
* Moved serverIdleTimeout to NetworkManager
* fixed test to enable disconnectInactiveConnections
* Copied disconnectInactiveConnections & serverIdleTimeout to NetworkServer
Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
Co-authored-by: Paul Pacheco <paulpach@gmail.com>
* Tests for most uses of sync list
renaming classes for existing test files
* improving error message for Paramless constructor
* More tests for SyncLists
* updating error message
* ignore abstract classes
we dont need to process abstract classes because classes that
inherit from them will be processed instead
* check and error for syncList item being genric
* allowing extra base types for synclist
* checking for nested types in abstract classes
* test for nested types inside structs
OnNetworkDestroy is not a good name, is it server? is it client?
you can't tell by the name.
Moreover, we have OnStartClient, API should be symetric so we should
have a corresponding OnStopClient.
Note this keeps backwards compatibility with an Obsolete for now
* test for using Generic SyncList
* adding error to network behaviour when generic sync object is used
* ignore generic classes
we can not process generic classes
we give error if a generic syncObject is used in NetworkBehaviour
* feat: NetworkMatchChecker Component
* Added docs
* feat: Use logger framework for NetworkClient (#1685)
* Use logger framework for NetworkClient
* Update Assets/Mirror/Runtime/NetworkClient.cs
Co-authored-by: vis2k <info@noobtuts.com>
* breaking: NetworkVisbility component (#1681)
* backup
* breaking: NetworkProximityCheck abstract class. Simplifies code, reduces complexity, improves performance because if 10k identities have 10 components each, we don't have to iterate 100k components each time we rebuild observers.
* update tests and checkers
* DisallowMultipleComponents
* fix tests
* split OnCheckObserver check
* fix tests
* syntax
* update comment
* renamed to NetworkVisibility
* forgot to remove comment
* breaking: Network Visibility Component
* changing namespaces of performance tests (#1689)
* Updated to use NetworkVisibility
* Updated comments
* Updated OnCheckObserver and removed OnSetHostVisibility
* tests for OnCheckObserver
* adding check for empty guid
* tests for changing matchId
* RebuildObservers if player left a match
* Refactored to make it simpler
Co-authored-by: Paul Pacheco <paulpach@gmail.com>
Co-authored-by: vis2k <info@noobtuts.com>
Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
* fix: serialize structs in other assemblies
fixes#1570
* removing check for type in another assembly
* fixing call to default constructor
* removing old tests that not longer apply
* fixing typo
* adding error when creating writer for unity base classes
* Test for Generating Reader and Writer functions
* removing old function
Co-authored-by: Paul Pacheco <paulpach@gmail.com>
* adding dirty check before update sync var
* Moving creating spawn payload to its own function
* updating tests
* adding tests for behaviour mask
* adding comment
* removing un-needed cast
* Adding SyncVar methods
this will allow SyncVars to still work if user overrides
OnSerialize as long as they call base.OnSerialize
* Adding tests for NetworkBehaviour OnSerialize
These tests make sure that weaver correctly create code for syncvar
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* Update Assets/Mirror/Runtime/NetworkBehaviour.cs
* adding extra test
Co-authored-by: Paul Pacheco <paulpach@gmail.com>
Co-authored-by: vis2k <info@noobtuts.com>
* Adding changed check to PreprocessorDefine
this stops ProjectSettings being marked as dirty each time the editor is opened
* Update PreprocessorDefine.cs
Co-authored-by: vis2k <info@noobtuts.com>
* Moving error check to when cache is created
* updating tests for new code behaviour
* Update Assets/Mirror/Runtime/NetworkIdentity.cs
Co-authored-by: vis2k <info@noobtuts.com>
* Using writer for local connection
LocalConnectionBuffer
* removing assert
* fixing error and cleaning up code
* removing old queue
* tests for LocalConnectionBuffer
* removing field
* removing extra lines
* Update LocalConnections.cs
removing empty line
* adding comment for packet count
* feat: logging api
Provide a ILogger (from unity framework) per class
it can track loggers per class and use Debug.unityLogger by default
* Logger field should never change
* Support loggers for static classes
Unfortunately we can't have generics with static classes.
Thus we can keep the loggers in a Dictionary instead indexed by name
if you need a logger for a static class, you can just do:
private static readonly ILogger logger = LogFactory.GetLogger(nameof(MyClass));
* Remove unused using
* Better tests by providing a mock handler
* using array in NetworkWriterPool instead of stack
* Using property
adding debug warning if pool is full
* adding tests for NetworkWriterPool
* Update NetworkWriterPool.cs
* Update NetworkWriterPoolTest.cs
Co-authored-by: vis2k <info@noobtuts.com>
* perf: use byte[] directly instead of MemoryStream
* Optimize writing int32 and int64
* Update Assets/Mirror/Runtime/NetworkWriter.cs
Co-Authored-By: vis2k <info@noobtuts.com>
* Update Assets/Mirror/Runtime/NetworkWriter.cs
Co-Authored-By: vis2k <info@noobtuts.com>
* Update Assets/Mirror/Runtime/NetworkWriter.cs
* Start with bigger buffer
* Woops, should have double checked suggestion
* Removed invalid Test
We should not require NetworkWriter to behave in certain way when Position
is set to out of bounds.
That is an invalid use of NetworkWriter, so NW should be free to do any behavior
* smells
* Update NetworkWriter.cs
Co-authored-by: vis2k <info@noobtuts.com>
* fix: #1515 - StopHost now invokes OnServerDisconnected for the host client too
* avoid NullReferenceException when calling StopHost without StartHost
* test WIP
* test
* feat: now you can assign scenes even if not in Editor
Instead of using scene name, scenes are now identified by path.
This fixes a couple problems:
1) In the room example, now you can assign the scenes even if they have
not been added to the editor. This was a constant pain because if you
open the offlinescene, all the scenes got wiped. You had to add the
scenes to the editor and reassign them all again. With this PR you
will still need to add them to the editor, but they will remain
assigned.
2) It is possible for multiple scenes to have the same name, but it is
not possible for multiple scenes to have the same path. So this is
a more robust way to identify scenes
This also greatly simplifies the scene SceneDrawer
BREAKING CHANGE: You will need to reassign your scenes after upgrade
* Automatically fix properties that were using name
If you open a NetworkManager or other gameobject that uses a scene name
it now gets converted to scene path by the SceneDrawer
* Use get scene by name
* Scene can never be null
* Update Assets/Mirror/Examples/AdditiveScenes/Scenes/MainScene.unity
* Issue warning if we drop the scene
* Issue error if scene is lost
* Add suggestion on how to fix the error
* Keep backwards compatibility, check for scene name
* cache the active scene
* Update Assets/Mirror/Editor/SceneDrawer.cs
Co-Authored-By: James Frowen <jamesfrowendev@gmail.com>
* GetSceneByName only works if scene is loaded
* Remove unused using
Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
* NetworkTransform rotation compression removed. Gets rid of endless discussions, optimizations and issues. Sending a quaternion is never going to fail.
* keep empty file
* keep empty file
* fix: #1593 - NetworkRoomManager.ServerChangeScene destroys the world player after replacing the connection, not before. previously ReplacePlayerForConnection would operate on dead data.
* remove it entirely
* NetworkIdentity.isServer simplified via one flag instead of helper variable + netId check
* simplify teardowns
* NetworkIdentityTests can set isServer directly now
* networkbehaviourtests simplified
* NetworkServerTests can set isServer directly now
* remove comment
* fix#1484: revert isServer simplifiy. Fixes a bug where isServer was already false in OnDestroy, but we need sometimes still need it there to save skillbars etc.
* update comment
* failing tests for virutal methods used by syncvar hook
* replacing Assert.fail to stop OnDeserialize failed error
* adding tests to make sure classes are set up correctly
* fix: call overriden hooks
Use a virtual call for hooks. fixes#1581
Co-authored-by: Paul Pacheco <paulpach@gmail.com>
* Move comments to the previous Lines
We have a mix of comments at on the previous line and at the end of
the line. We need to "pick one way and stick with it".
Per the C# code guidelines, comments go on the previous line. See here:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions
This also makes pull requests more readable since comments are less
likely to wrap
There are no code changes here, just a search and replace for all comments
This also makes cloc counts more accurate as it can better determine
how many lines of comments vs code we have
* Update Assets/Mirror/Components/NetworkTransformBase.cs
* Update Assets/Mirror/Examples/ListServer/ListServer.cs
* Update Assets/Mirror/Tests/Editor/WeaverTests~/TestingScriptableObjectArraySerialization.cs
* Update Assets/Mirror/Tests/Editor/WeaverTests~/TestingScriptableObjectArraySerialization.cs
* Adding check to make sure weaver adds code
* tests for network behaviour
* marking methods as static
* adding comment to method body
* making Weaver internal
* replacing string
Once upon a time, connections could be null here. This is no longer
the case, connections always have something,
Even if they were null, this method would not work at all because
the conn.Send call at the bottom would throw NRE.
Therefore the null checks here are unnecesary
Since messages behave similar to events and given the process is not technically breaking, using LogError seems incorrect. Using Log, maybe LogWarning would be more appropriate. Added additional text to clarify why the user may be seeing that log entry.