# Before
This is hard to read:
```
if (ca.AttributeType.FullName == typeof(Mirror.CommandAttribute).FullName) {
...
}
```
# After
```
if (ca.AttributeType.Is<Mirror.CommandAttribute>()) {
...
}
```
# Before
WeaverTypes declared a static variable like this:
```cs
public static TypeReference int32Type;
```
Weavertypes then loaded the variable in SetupTargetTypes like this:
```cs
int32Type = ImportSystemModuleType(currentAssembly, systemModule, "System.Int32");
```
Note we lookup the type with a string, any typo there won't be detected until the code is executed. It will also not be found by the IDE when you click "find references", or when you refactor.
Then we use it like this:
```cs
var intType = WeaverTypes.int32Type;
```
This is a DRY violation: I have to modify 3 different code sections just to say that I want the int32 type.
# After
Get rid of all the duplication, and use the type instead of a string:
```cs
var intType = WeaverTypes.Import<int>();
```
No need for static variable, or to add it in SetupTargetTypes.
* fixing null ref error when local player is destroyed
* removing null objects
* fixing InvalidOperationException
* moving code to its own function
* Update Assets/Mirror/Runtime/ClientScene.cs
* Update ClientScene.cs
Improving logging
- making sure sceneId is always hex
- only logging "Client spawn for ..." if it was successful
* Update ClientSceneTests_OnSpawn.cs
- Adding handlers in Awake instead of Start to make sure they are added before start on headless
- using GetComponent for NetworkManagerListServer
- Adding asserts to make sure values are set
* moving FakeNetworkConnection to common test folder
* adding test for local player destroy
* adding method to clear local player
* temp move test functions
* adding test for destroying non player
* moving asset to setup
* adding tests for destroy message and host mode
* adding ClearLocalPlayer to reset
* Removing manual invoke for Cmd and RPC
There should be no reason to manaully invoke remote code
they are marked with EditorBrowsableState.Never which implies they should not be called by the user
* removing tests
* adding note to guides about removed SyncEvent
* updating Obsolete
making Obsolete error whe used
updating text to say it has been removed
linking to issue
* adding Obsolete note to other references to SyncEvent
* Remove ScriptTemplates to clean up folder
* Update main.yml
Removing script templates from CI
Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
* fix adding error for gernated read writer for abstract class
weaver can not initialize class abstract class so cant not create a reader
this gives a helpful error telling the server to make a custom reader
* adding tests for error message
* fixing typo
* renaming
* fixing expected error messages
Reader code doesn't run on Rpc now if a valid writer can not be found
In future PR write and read functions should be generated together as they share most of the same checks
* replacing assert with haserror
* adding IsSuccess and HasWarning functions
* using IsSuccess
* checking weaverWarnings empty in success
* using HasWarning
* replacing asserts missed by regex
* fixing typo
* adding HasNoErrors function to be used when tests only have warnings
* fixing typo
* making fields public to stop warnings
* simplifying more test files
* adding generated test for other baseclasses
* removing errors when attribute is not in networkbehaviour
* temp weaver tests
* updating weaver tests for monobehaviour
* adding weaver tests for non-networkbehaviour
* moving where serverclient attributes are processed
* removing un-used code
* regenerate tests
* adding check for no connections
Dont need to run Server Update if there are no connections
* adding toggle to disable skip
* formatt
* removing skipUpdateIfNoConnections check, and merging if checks
* removing extra line
* adding tests for NoConnections
* replacing isHeadless with isServerBuild
* renaming startOnHeadless
* fixing isServerBuild bool
* making property a field instead
* replacing isServerBuild for #if UNITY_SERVER
* fixing comment and removing extra lines
* removing system from System.Obsolete
* renaming to autoStartServerBuild
* adding assert to make sure transport is set
this helps people who want to connect without using networkmanager
* moving Transport.activeTransport to setup
* replacing Substitute.For for addComponent
Can't used Substitute for monobehaviours as they will still be null with unity equals
* weaver test for abstract methods
* doing nothing is method is abstract
* not calling base if it is abstract
* adding tests for message to make sure they work
* weaver tests for list read write
* generated tests for list read write
* adding method to check for list type
* temp
* weaver functions for creating read write for list
* generating tests for lists
* adding generated tests for collection writers
tests for read+write for array and array segment
* changing menu path
* adding tests for collections of classes
* swapping order in class name
* tests for Server attribute on virtual methods
test for virtual, abstract and override methods
* adding test for client attribute
* adding error when attribute is put on abstract method
* improving error message
* updating error mesages in tests
* updating to use WeaverTypes
* adding check before error
* class to create test functions
* generated test folder
* generated attribute tests
* adding out function and long type
* generated test file
* using OneTimeSetUp to make tests run faster
* Added Layer Weight to NetworkAnimator
Now NetworkAnimator is aware of each layer weight on it's references
Animator and will sync layer weights across the network.
* NetworkAnimator layers Float equality fix
* Update Assets/Mirror/Components/NetworkAnimator.cs
Co-authored-by: James Frowen <jamesfrowen5@gmail.com>
* Update Assets/Mirror/Components/NetworkAnimator.cs
Co-authored-by: James Frowen <jamesfrowen5@gmail.com>
* Remove GetLayerWeight check every incoming packet as is extern call
Co-authored-by: James Frowen <jamesfrowen5@gmail.com>
* Adding asmdef to telepathy
mirror has to reference telepathy as it is the default transport
this also means that TelepathyTransport has to be in the mirror asmdef
* references telepathy in tests
* formatting asmdef