Commit Graph

4489 Commits

Author SHA1 Message Date
MrGadget
aa41c5f5e0
Make NetworkConnection.observing public (#2942)
- NetworkIdentity.observers is already public
2021-09-25 11:27:25 +08:00
vis2k
7e546cf799
fix: #2928 - Weaver now recommends 'readonly' keywords for SyncObjects (#2941)
* fix: #2928 - Weaver now recommends 'readonly' keywords for SyncObjects. prepares for SyncField<T> as well.

* fix weaver tests
2021-09-25 11:27:03 +08:00
MrGadget1024
51cf44cde7 Simplified interpolations 2021-09-24 07:21:46 -04:00
MrGadget1024
23f1b2b0a5 Remove unnecesary pragmas 2021-09-24 07:21:02 -04:00
MrGadget
60692f0373
Force Network Manager to scene root if DDOL (#2936) 2021-09-24 12:52:53 +08:00
vis2k
2d2710f60e Weaver: SyncVarProcessor renamed to SyncVarAttributeProcessor 2021-09-24 11:03:51 +08:00
vis2k
a0c3ef1c2c SyncVarTests renamed to SyncVarAttributeTests 2021-09-24 10:57:43 +08:00
MrGadget1024
83c92ce9bf Updated Pong Example
- Applied BallPhysics material to Ball
- Turned off Sync / Interp Rotation on Ball and Racket
2021-09-23 14:03:39 -04:00
MrGadget1024
f1cf841bea Added NI to PlayArea in Game scene of MultipleAdditiveScenes example 2021-09-21 06:29:12 -04:00
vis2k
ad391f2b5f breaking: NetworkBehaviour.SyncVar/GameObject/NetworkIdentity/NetworkBehaviourEqual functions made internal.
-> avoid tests exposed workarounds
-> prepares for SyncField<T>
2021-09-21 16:50:14 +08:00
vis2k
6a1f355a63 Tests: SyncVarNetworkIdentityEqual exposing simplified now that it's static 2021-09-21 16:41:02 +08:00
vis2k
d51fd23175 Weaver: SyncVarprocessor.GenerateSyncVarSetter simplified again now that all equals functions are static 2021-09-21 16:22:26 +08:00
vis2k
4cbf575a2d Weaver: NetworkBehaviour.SyncVarEqual made static (cleaner, reusable from the outside for SyncField<T> later) 2021-09-21 16:22:26 +08:00
vis2k
6ff39bc0a0 Weaver: NetworkBehaviour.SyncVarGameObjectEqual made static (cleaner, reusable from the outside for SyncField<T> later) 2021-09-21 16:22:21 +08:00
vis2k
e18ecf8a01 Weaver: NetworkBehaviour.SyncVarNetworkBehaviourEqual made static (cleaner, reusable from the outside for SyncField<T> later) 2021-09-21 16:22:16 +08:00
vis2k
cbf9987d1a Weaver: NetworkBehaviour.SyncVarNetworkIdentityEqual made static (cleaner, reusable from the outside for SyncField<T> later) 2021-09-21 16:22:10 +08:00
vis2k
fd70b2a6ad Weaver: SyncVarProcessor.GenerateSyncVarSetter: Ldarg_0, Ldarg_1 moved into if branches so that methods like SyncVarNetworkIdentityEqual can be made static
(static functions can't have 'this' as first parameter on stack)
2021-09-21 16:22:01 +08:00
vis2k
74c0f271c9 NetworkBehaviour.HasSyncObjects: internal is enough 2021-09-21 11:30:41 +08:00
vis2k
f1b8aa4fc2 feature: NetworkBehaviour: HasSyncObjects for NetworkBehaviourInspector to avoid Reflection 2021-09-21 11:28:02 +08:00
vis2k
7c28f06c8f NetworkBehaviourInspector: remove unused syncVarNames 2021-09-21 11:22:37 +08:00
vis2k
8c0bd9dca2 syntax & comments cleanup 2021-09-21 11:20:44 +08:00
MrGadget1024
7aebf4cb5a syntax 2021-09-20 13:19:53 -04:00
MrGadget
a38800b443
Refactor match int mgmt (#2935)
* fix: Eliminate potential NRE's in MatchInterestMgmt
- Scene objects with no NetworkMatch component
- Key not found in lastObjectMatch Dictionary

* Added comment, combined if's

* Added comments

* refactor Match Int Mgmt

* removed unused parameter

* removed unused parameter
2021-09-20 12:47:08 -04:00
vis2k
d9d84b6bcc explain SyncVar hook guard 2021-09-20 23:57:25 +08:00
MrGadget
f88190b756
fix: Eliminate potential errors in MatchInterestMgmt (#2934)
* fix: Eliminate potential NRE's in MatchInterestMgmt
- Scene objects with no NetworkMatch component
- Key not found in lastObjectMatch Dictionary

* Added comment, combined if's

* Added comments
2021-09-20 11:56:26 -04:00
vis2k
e0da23e45c add comment 2021-09-20 21:16:06 +08:00
MrGadget
8555048548
feat: Implemented ChangeOwnerMessage (#2924)
* Implemented ChangeOwnerMessage
- Separates ownership change from Spawn message
- NetworkIdentityTests updated

* commented log
2021-09-20 20:43:10 +08:00
MrGadget1024
c8bea97491 String interpolation in SyncVarAccessReplacer 2021-09-20 08:18:32 -04:00
MrGadget1024
4c60de6680 String interpolation in SyncVarAccessReplacer 2021-09-20 08:15:46 -04:00
MrGadget
9cab21921f
String interpolation (#2930)
* Use String Interpolation

* Update Assets/Mirror/Editor/Weaver/EntryPointILPostProcessor/ILPostProcessorFromFile.cs

* Proper case in comments

* Add a constructor overload for creating a SyncDictionary from an IDictionary (#2933)

* Add a constructor overload for creating SyncDictionary from Dictionary

* Use IDictionary and directly use the passed in value

* Use passed in value directly

* Nope: SyncDictionary should specifically use a Dictionary under the hood

Reread the docs

* comment

* syntax

* Weaver: PropertySiteProcessor renamed to SyncVarAccessReplacer and updated comments/syntax to make it easier to understand

* Weaver: WeaverLists renamed to SyncVarAccessLists because that's what it's for

* comment

* Weaver: GetSyncVarStart simplified

* comment

* fix: Obsolete SyncObject Flush method (#2931)

* fix: Obsolete SyncObject Flush method

* fixed test

Co-authored-by: vis2k <info@noobtuts.com>
Co-authored-by: Gabriel Elkind <pixelpax@users.noreply.github.com>
2021-09-20 08:07:07 -04:00
MrGadget
185a6c3815
fix: Obsolete SyncObject Flush method (#2931)
* fix: Obsolete SyncObject Flush method

* fixed test
2021-09-20 19:40:46 +08:00
vis2k
1afed306af comment 2021-09-20 19:19:20 +08:00
vis2k
9f4cf44217 Weaver: GetSyncVarStart simplified 2021-09-20 19:17:08 +08:00
vis2k
e755c2ad9a comment 2021-09-20 19:12:08 +08:00
vis2k
37af48b83e Weaver: WeaverLists renamed to SyncVarAccessLists because that's what it's for 2021-09-20 19:11:20 +08:00
vis2k
3dbab83615 Weaver: PropertySiteProcessor renamed to SyncVarAccessReplacer and updated comments/syntax to make it easier to understand 2021-09-20 19:07:39 +08:00
vis2k
c0db7fce38 syntax 2021-09-20 18:53:12 +08:00
vis2k
411a531eda comment 2021-09-20 18:51:55 +08:00
Gabriel Elkind
052cf6c183
Add a constructor overload for creating a SyncDictionary from an IDictionary (#2933)
* Add a constructor overload for creating SyncDictionary from Dictionary

* Use IDictionary and directly use the passed in value

* Use passed in value directly

* Nope: SyncDictionary should specifically use a Dictionary under the hood

Reread the docs
2021-09-20 11:42:34 +08:00
MrGadget1024
c120623d7d Proper case in comments 2021-09-19 15:15:16 -04:00
vis2k
af0a67d4f8 comment 2021-09-19 20:12:31 +08:00
vis2k
a848b8bb7c feature: Tanks demo health bars to test [SyncVar]s 2021-09-19 19:51:20 +08:00
vis2k
b537d423a1 use string interpolation everywhere 2021-09-19 17:00:36 +08:00
vis2k
a6d686fae1 NetworkBehaviour.SetDirtyBit renamed to SetSyncVarDirtyBit because that's what it does. avoids misconceptions. 2021-09-19 16:53:08 +08:00
vis2k
bc4224dcb7 syntax 2021-09-19 16:18:00 +08:00
vis2k
0743e73ad8 syntax 2021-09-19 15:51:06 +08:00
vis2k
d573e69e44 NetworkServer.SendToReady(identity, ...) misleading name changed to SendToObservers because it actually sends to the identity's observers, not to all ready connections 2021-09-19 15:50:32 +08:00
Robin Rolf
0828087e70
NetworkLoop needs to be public to expose events (#2925)
See ff34a50fdf and #2826
2021-09-19 15:37:13 +08:00
vis2k
272baceabb
perf: NetworkServer.Broadcast O(N) spawned iteration removed. dirty bits for spawned without observers are now cleared when adding the first observer instead (#2923)
* change test to add observer

* perf: NetworkServer.Broadcast O(N) 'remove dirty bits for all spawned entities without observers' loop removed. AddObserver clears them instead if we had no observers before.

* don't need this anymore

* set syncobj.recording

* oops

* not a TODO anymore

* fix test

* fix test

* fix test

* fix tests

* fix test

* fix tests
2021-09-19 11:09:35 +08:00
vis2k
10689d3131
feature: SyncObject IsRecording() to prepare for NetworkServer.Update not calling ClearAllComponentsDirtyBits on all spawned entities with no observers. (#2926)
* feature: SyncObject IsRecording() to prepare for NetworkServer.Update not calling ClearAllComponentsDirtyBits on all spawned entities with no observers.

* fix test
2021-09-19 11:05:40 +08:00
MrGadget
4efb0a64ff
fix: Clear hasAuthority when Unspawning (#2927)
* fix: Clear hasAuthority when Unspawning

* Added UnSpawnAndClearAuthority test
2021-09-19 10:15:42 +08:00
MrGadget1024
113d2b9cf9 fixed comment 2021-09-18 14:06:31 -04:00
vis2k
20daad4806 add TODOs 2021-09-18 23:43:47 +08:00
vis2k
c1a7920076 remove test assert that depends on the current way where changes are actually tracked and only cleared in update 2021-09-18 23:33:24 +08:00
vis2k
2df0975752 Test: SyncList/Set/Dictionary ever growing changes while no observers prevention 2021-09-18 23:23:55 +08:00
vis2k
cb46fd5ce4 SyncList.changes comments 2021-09-18 20:09:39 +08:00
vis2k
81114a498f i dont need to leave comments 2021-09-18 19:47:57 +08:00
vis2k
0ede6b9da9 NetworkIdentity.RemoveObserverInternal renamed to RemoveObserver for consistency with AddObserver (both functions are internal anyway) 2021-09-18 19:05:51 +08:00
vis2k
d2acc707ac NetworkIdentity: group observer add/remove/clear functions together 2021-09-18 19:03:50 +08:00
vis2k
de032d6edb better 2021-09-18 19:01:32 +08:00
vis2k
3a70eeccfd better 2021-09-18 18:58:15 +08:00
vis2k
6a50fd0c7f Tests: NetworkServer dirty bits if no observers clearing test 2021-09-18 18:55:10 +08:00
MrGadget1024
9727e0e7e2 updated comment 2021-09-18 06:19:01 -04:00
Devon Merner
413b612856
Prevent NetworkManager.ServerChangeScene from being called if a scene change is already in progress for that scene. (#2903) 2021-09-18 16:16:47 +08:00
vis2k
20056edc0f NetworkServer.Broadcast: explain ClearSpawnedDirtyBits better 2021-09-18 12:34:52 +08:00
vis2k
acebef0e16 NetworkBehaviour.IsDirty: OR both bitmasks instead of comparing separately. 2021-09-18 12:04:18 +08:00
vis2k
2208b6ce52
perf: breaking: SyncObjects (SyncList/SyncSet/SyncDict) Dirty Searching (O(N)) replaced with bit mask (O(1)) (#2922)
* wip

* internal field

* huh

* more

* use ondirty

* wip

* fix index

* test

* syntax

* restore old TOOD

* xml comment

* fix broken test
2021-09-18 11:56:28 +08:00
vis2k
3d624941a5 fix broken test from rename 2021-09-17 18:44:09 +08:00
MrGadget1024
1bc8232d60 Updated NetworkManager ScriptTemplate 2021-09-17 04:22:52 -04:00
vis2k
76ebb86d6d Tests: don't need to inherit from SyncList<T> anymore 2021-09-17 14:53:02 +08:00
vis2k
ccb901e708 remove strange import 2021-09-17 14:50:39 +08:00
vis2k
1a5fedf9bf Tests simplified 2021-09-17 13:37:49 +08:00
vis2k
a9c0ae014a Tests simplified 2021-09-17 13:36:18 +08:00
vis2k
8adb00bebe Tests simplified 2021-09-17 13:34:46 +08:00
vis2k
1487b2a27c Tests simplified 2021-09-17 13:33:01 +08:00
vis2k
c722f6988c breaking: SyncObject.Flush() renamed to ClearChanges() to make it more obvious.
'Flush' sounds like changes would be sent out over the wire.
When really it only clears changes.
2021-09-17 13:27:05 +08:00
vis2k
53d316bd9f syntax 2021-09-17 13:01:11 +08:00
vis2k
79f492aaf8 TODO 2021-09-17 12:48:55 +08:00
vis2k
19747954a3 fix: Weaver now allows exactly 64 SyncVars too 2021-09-16 21:50:44 +08:00
vis2k
88e1be8965 Tests: rename 2021-09-16 21:48:52 +08:00
vis2k
f01a701779 Tests: Weaver: SyncVarsExactlyMax 2021-09-16 21:48:18 +08:00
vis2k
6ebcbd8311 Tests: Weaver: SyncObjectsExactlyMax 2021-09-16 21:39:39 +08:00
vis2k
42cc181cfa syntax 2021-09-16 21:37:42 +08:00
vis2k
2e0b58c624 rename 2021-09-16 21:36:39 +08:00
vis2k
d1e60a0f62 fix: Weaver now detects and shows an error for >64 SyncObjects instead of silently not syncing them 2021-09-16 21:26:09 +08:00
vis2k
c77a50258d Too many SyncVars message improved with exact amount 2021-09-16 21:16:13 +08:00
vis2k
4daabd2fe4 syntax 2021-09-16 20:58:54 +08:00
vis2k
107e5b9f3b add comments 2021-09-16 15:13:09 +08:00
vis2k
98082c8527 comments 2021-09-16 14:50:06 +08:00
vis2k
3da14d2430 Tests: SetDirtyBit 2021-09-16 14:49:33 +08:00
vis2k
f43a29e712 NetworkBehaviour.AnySyncObjectDirty: reuse DirtyobjectBits 2021-09-16 14:42:44 +08:00
vis2k
0ad7cf7da7 Tests: IsDirty checks sync interval 2021-09-16 14:41:31 +08:00
vis2k
58ef1faaf9 Tests: IsDirty 2021-09-16 14:40:30 +08:00
vis2k
7828f25875 Tests: add SyncVars 2021-09-16 14:38:43 +08:00
vis2k
d9320b72f4 syntax 2021-09-16 14:37:06 +08:00
vis2k
cc22fabe1d syntax 2021-09-16 14:36:38 +08:00
vis2k
b5b3d33704 syntax 2021-09-16 14:35:31 +08:00
vis2k
f161fa8f43 NetworkBehaviour: DirtyObjectBits grouped to the dirty code section 2021-09-16 14:35:08 +08:00
vis2k
0954fb2b44 comment 2021-09-16 14:32:18 +08:00
vis2k
6b57e34d80 comment 2021-09-16 14:30:22 +08:00
vis2k
42e5a4d5ce NetworkBehaviourDirtyBitsTests: AnySyncObjectDirty 2021-09-16 14:28:29 +08:00
vis2k
2f2feb4d93 Tests: NetworkBehaviourDirtyBitsTests to prepare for cleanups 2021-09-16 14:21:34 +08:00
vis2k
860ee754f4 comment 2021-09-16 14:14:11 +08:00
vis2k
cf02df3a72 comment 2021-09-16 14:12:02 +08:00
vis2k
c4cc416385 comment 2021-09-16 14:11:01 +08:00
vis2k
bae099a981 syntax: NetworkBehaviour: group dirty bit code together 2021-09-16 14:10:20 +08:00
vis2k
6bd5cd7bb9 comment 2021-09-16 14:08:42 +08:00
vis2k
1b842bb168 comments 2021-09-16 14:06:29 +08:00
vis2k
e9a6b6e3d3 breaking: get/setSyncVarHookGuard renamed to Get/SetSyncVarHookGuard 2021-09-16 13:53:21 +08:00
vis2k
e4305b9d97 fix: disable weaver registered twice logs on ILPP again 2021-09-16 13:51:36 +08:00
vis2k
bb61c5324f comment 2021-09-16 13:39:25 +08:00
vis2k
f479a7404a syncVarDirtyBits comment 2021-09-16 13:38:39 +08:00
vis2k
b6fad02f13 remove unused import 2021-09-16 13:32:45 +08:00
MrGadget1024
5cde52171f formatting 2021-09-12 17:30:44 -04:00
MrGadget1024
c0dba76d35 Fixed typos in comments 2021-09-12 16:48:54 -04:00
MrGadget1024
4797007979 Removed unnecessary componet 2021-09-11 11:55:32 -04:00
vis2k
3bd30d13e2 Revert "Syntax"
This reverts commit 73c47b5fc3.
2021-09-07 11:22:42 +08:00
Justin Nolan
32f0fa47ef
Update weaver log, remove unused test and make transport send methods abstract (#2910)
* Turn on duplicate writer/reader logs in weaver

* Make Transport Client/ServerSend abstract

* Remove unused test
2021-09-07 11:20:48 +08:00
MrGadget1024
fe021f8fe7 fix: updated NetworkTransform2k test 2021-09-06 14:21:58 -04:00
MrGadget1024
73c47b5fc3 Syntax 2021-09-06 14:21:58 -04:00
vis2k
198fed4bdf comment 2021-09-07 01:16:45 +08:00
MrGadget1024
e565fce30b Updated comments 2021-09-06 13:15:36 -04:00
MrGadget1024
50ee8737a5 Moved FalbackTransport to Empty folder 2021-09-06 13:07:13 -04:00
MrGadget
8612c023a6
breaking: Remove Obsoletes (#2909)
* breaking: Remove Obsoletes
- MIRROR_47_0_OR_NEWER symbol added
- A few obsoletes with Network Visibility remain...not ready to remove just yet.

* fixed test
2021-09-07 00:10:36 +08:00
MrGadget1024
3afd3ba726 Updated deprecation dates
- We still need to replace NetworkOwnerChecker
2021-09-06 11:31:12 -04:00
MrGadget1024
9c4cc2926f fix: NTv2 interpolateScale default false, like syncScale 2021-09-06 11:15:46 -04:00
MrGadget1024
d457103850 fix: Updated NTv2 settings in examples 2021-09-06 10:01:02 -04:00
MrGadget1024
f2b3329c6f feat: Updated Additive Scenes example
- Now uses Distance Interest Management
- Adjusted position & rotation of scene objects
- Tank and Player have custom distance components
2021-09-06 09:36:55 -04:00
vis2k
1827b9558b remove unnecessary test 2021-09-06 17:25:59 +08:00
vis2k
5ab2ef0c6a Test: remove unused 2021-09-06 17:23:51 +08:00
James Clancey
8400cc46cd
Fixes a crash, if you stop discovery. (#2908)
* Fixes a crash, if you stop discovery.

* Update NetworkDiscoveryBase.cs

Co-authored-by: vis2k <info@noobtuts.com>
2021-09-06 17:17:34 +08:00
vis2k
d23403c0a3 NetworkTransformBase: expose IsClientWithAuthority 2021-09-05 20:20:22 +08:00
Justin Nolan
5bfc96d8ba
Remove obsolete weaver method calls (#2904)
* Weaver uses NetworkClient.connection instead of NetworkClient.readyConnection for client targetrpcs

* Update weaver tests to not use obsoletes

* Update test to expect SyncList<int> instead of SyncListInt
2021-09-05 19:30:50 +08:00
JesusLuvsYooh
7d4d5bf597
Default variables adjusted. (#2899)
- Old default variables are for 'worst case connection' types, or fine for casual social game movement.
- It should be set as minimum delay, whilst still containing some smooth buffer data by default.
- Tool tip suggests what users can change it to for non-ideal connections from the new default value.
- First impressions are vital.
2021-09-04 20:44:54 +08:00
vis2k
5128c4f987 MIRROR_46_0_OR_NEWER 2021-09-03 14:11:16 +08:00
vis2k
57f9923f78 OnTransportData: too short error changed to warning. it can happen if an attacker sends random data. 2021-09-02 19:30:37 +08:00
vis2k
f67704bbd9 UnpackAndInvoke: invalid message header errors changed to warnings. it can happen if an attacker sends random data. 2021-09-02 19:29:31 +08:00
vis2k
2026b6038b Tests for #2882 2021-09-02 19:17:56 +08:00
vis2k
0c65d29a32 NetworkServer/NetworkClient: UnpackAndInvoke disconnect responsibility moved to caller to avoid unbatcher count error. we already know what happened and we already disconnect anyway. 2021-09-02 19:10:10 +08:00
vis2k
99e0a6f401 update comments 2021-09-02 19:01:18 +08:00
vis2k
86eeecc9cf fix: #2882 UnpackAndInvoke now errors and disconnects in case of missing handler. This is necessary because messages in a batch are not length prefixed. we always need to read to the end, otherwise it overlaps into the next one, causing undefined behaviour. 2021-09-02 18:50:01 +08:00
vis2k
181267b99d add explanation to errors 2021-09-02 18:39:29 +08:00
vis2k
bce20b5f46 add comment 2021-09-02 18:36:36 +08:00
vis2k
3e4def126f fix: NetworkServer/NetworkClient batch processing now detects ever growing batches (as caused by #2882) 2021-09-02 18:31:43 +08:00
vis2k
9578deeb55 typo 2021-09-02 17:43:35 +08:00
vis2k
f6399f91db Tanks example: add GUIConsole to camera for easier debugging 2021-09-02 13:50:03 +08:00
MrGadget1024
d559d45031 fixed usings order 2021-08-31 10:45:03 -04:00
vis2k
04c364346e
fix: Weave via ILPostProcessor (Unity 2020+) fixes #2872 #2685 #1491 #2683 #2880 (#2891)
* WeaverTypes: make imported ReaderExtensions public

* WeaverTypes: import WriterExtensions too

* process reader/writer extensions

* rebase squashed previous ilpostprocessor branch

* adjust to weaver preparations changes

* fix: show strack trace

* better

* readability

* fix file not found cecilx exception

* fix rocks nto found exception

* syntax

* pass Mirror.dll to Weave()

* ILPostProcessorAssemblyResolver from paul

* comments, ifdef, syntax

* ILPostProcessorAssemblyResolver: add logging

* ILPostProcessorAssemblyResolver: add warnings on why Resolve() failed

* comments

* better warning

* rename

* use the custom resolver

* fix: ILPostProcessorReflectionImporter to fix System.Private.CoreLib not being found in Resolver

* add TODO

* comment

* fix Mirror.dll Resolve() issues in ReaderWriterProcessor when resolving from the passed Mirror.dll.
DefaultAssemblyResolver doesn't work with ILPostProcessor.

* fix comment

* check mirror assembly resolve result

* pass resolver to weaver

* fix Mirror.dll resolving Mirror.dll types NullReferenceException

* comments

* syntax

* comments

* readability

* syntax

* forgot to save

* rebase

* write

* fix self referencing Mirror.dll assembly

* disable log

* make tests work again

* comment

* comment

* fix rebase

* fix rebase

* comment

* fix: WeaverAssembler: only invoke weaver manually on mac. ILPP is invoked on windows automatically.

* this too

* remove comment

* ifdef out CompilationFinishedHook

* CompiledAssemblyFromFile

* comments

* tests assembly renamed to access compilationpipeline

* wip

* comments

* handle logs

* move file

* use WeaverTests error handling functions

* ILPP hook: don't log weaving failed errors for consistency with old method, and so that tests still work

* ILPPLogger: don't log prefix

* disable weaving succeeded log

* remove comment

* WeaverAssembly: save result to file

* move

* Weaver tests: compilationpipeline dependencies moved into Unity.Mirror.Weaver.CodeGen assembly.
so Tests assembly is actually weaved.

* disable self reference warning

* CompiledAssemblyFromFile simplified

* remove unused

* comments; run ILPP in all cases not just on mac

* ignore compilermessages on 2020+.
fixes windows tests not running.

* comment

* fix: ILPostProcessor ignore define added so WeaverAssembler can tell it not to run after being invoked by Unity after AssemblyBuilder.Build(). fixes SyncVarSyncList test failing on windows because ILPP was ran on it twice.

* typo

* comment

* comment

* static

* ifdef for 2019 support

* ifdef for 2019
2021-08-29 15:43:20 +08:00
ninjakickja
92965731d1
fix: Fix delayed movement in client authority mode (#2856)
* Fix - From !isLocalPlayer to !hasAuthority

Changed !isLocalPlayer to !hasAuthority because object might not be player object.

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

* Fix - delayed movement in clients in ClientAuthority mode - NetworkTransformBase.cs

Fixed issue where clients experience delayed movement in client authority mode.
Problem: Clients update the server first, server builds buffer then moves object, and then sends server's current snapshot to all the other clients who then build their buffers first before moving. This results in delayed movement in clients.
Changed the process to pass on the snapshot which the authoritative client updates the server onwards to other clients immediately instead and added checks to ensure server only broadcasts when object is on server authority or on host client authority.

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

Co-authored-by: vis2k <info@noobtuts.com>
2021-08-28 23:23:57 +08:00
vis2k
aff6a8a9c9 fix: WeaverTests 'type was declared in both UnityEngine.dll and UnityEngine.CoreModule.dll' 2021-08-27 22:38:18 +08:00
vis2k
851ad16a17
breaking: Weaver: add ReaderWriterProcessor [Runtime/InitializeOnLoad] Attributes without Reflection (#2893)
* breaking: Weaver: [InitializeOnLoad] attribute is now added without using Reflection.
(possibly a breaking change according to the comment, although it's not obvious why it would break)

* breaking: Weaver: [RuntimeInitializeOnLoad] attribute is now added without using Reflection.
(possibly a breaking change according to the comment, although it's not obvious why it would break)

* comments

* fix builds
2021-08-27 21:06:22 +08:00
vis2k
e87f1cb6eb Weaver: IsEditorAssembly moved into Helpers 2021-08-26 15:38:24 +08:00
vis2k
67418620fc Weave: WeaveFromFile simplified 2021-08-26 13:16:05 +08:00
vis2k
bf5b0e36ec Weaver: FindMirrorRuntime changed to FindCompilationPipelineAssembly 2021-08-26 13:08:31 +08:00
vis2k
6d1a13fc27 syntax 2021-08-26 13:06:59 +08:00
vis2k
bb8268dd06 typo 2021-08-26 13:05:02 +08:00
Shaun He
56910a1f70
* fix: The type or namespace name 'Exception' could not be found (#2889) 2021-08-25 12:17:02 +08:00
vis2k
95b009a126 Weaver WeaveFromFile: remove unused parameter 2021-08-24 23:15:36 +08:00
vis2k
e8cf20847d Weaver: move writing out of Weave() 2021-08-24 12:45:28 +08:00
vis2k
7088938bb7 Weaver: pass AssemblyResolver to Weave() so ReaderWriterProcessor can resolve Mirror.dll from CurrentAssembly's References instead of passing the AssemblyDefinition / using reflection / opening the file from Weaver / etc.
-> prepares for ILPostProcessor which needs to use the resolver to find it
2021-08-23 19:03:50 +08:00
vis2k
5d629b0fb7 syntax 2021-08-22 21:36:28 +08:00
vis2k
41f1c7abb8 syntax 2021-08-22 21:36:04 +08:00
vis2k
ad107e3b84 comments on why reflection is used 2021-08-22 21:33:19 +08:00
vis2k
46368df7fe rename 2021-08-22 21:30:19 +08:00
vis2k
c6b9b33a47 Weaver: ReaderWriterProcessor AddRuntimeInitializeOnLoadAttribute / AddInitializeOnLoadAttribute helper functions 2021-08-22 21:30:00 +08:00
vis2k
057d765656 syntax 2021-08-22 21:08:04 +08:00
vis2k
b7ec1ebfad Weaver: Weave() now requires MirrorAssembly parameter. we resolve it in CompilationFinishedHook instead of ReaderWriterProcessor.
-> all processors can easily access the mirror assembly if necessary
-> CompilationPipeline doesn't have to be referenced anymore, which would break ILPostProcessor
-> Weaver simply weaves given assemblies now, without opening anything
2021-08-22 21:02:24 +08:00
vis2k
38e6cfb893 syntax 2021-08-22 20:56:21 +08:00
vis2k
0c698df4ca rename 2021-08-22 20:55:21 +08:00
vis2k
20be56079c syntax 2021-08-22 20:54:33 +08:00
vis2k
9db804467c syntax 2021-08-22 20:52:58 +08:00
vis2k
08fdffd6ab comments 2021-08-22 20:49:37 +08:00
vis2k
852ef64034 Weaver: syntax 2021-08-22 20:42:11 +08:00
vis2k
16579ea9e8 Weaver CompilationFinishedHook: FindMirrorRuntime returns the assembly so we can use that later 2021-08-22 20:34:54 +08:00
vis2k
98737b8863 rename and clarify 2021-08-22 17:36:07 +08:00
vis2k
8db0f34f2c Weaver: add comment 2021-08-22 17:18:20 +08:00
vis2k
265a6384e1 ReaderWriterProcessor: ProcessMirrorAssemblyReaderWriterExtensions helper function for cleaner code 2021-08-22 17:08:31 +08:00
vis2k
2420a6d18b Weaver: add comments 2021-08-22 00:30:57 +08:00
vis2k
6ba4124724 Weaver: weaverTypes doesn't need to be public anymore 2021-08-21 16:31:44 +08:00
vis2k
59b2d731ea WeaverClientServerAttributeTests: remove dependencies on Weaver.weaverTypes 2021-08-21 16:31:34 +08:00
vis2k
eb04bb4d58 syntax 2021-08-21 16:14:53 +08:00
vis2k
9d43d3c6c6 remove xml comment 2021-08-21 16:14:29 +08:00
vis2k
737a2b1b28 syntax 2021-08-21 14:44:26 +08:00
vis2k
37cfdbbcae comment 2021-08-21 14:43:58 +08:00
vis2k
32d6eb0689 typo 2021-08-21 14:42:11 +08:00
vis2k
3b756ecdc8 WeaverTestsBuildFromTestName split into separate file 2021-08-21 13:56:39 +08:00
vis2k
7d0ac8e992 comment 2021-08-21 13:52:57 +08:00
vis2k
e1f04153b1 syntax 2021-08-21 13:52:08 +08:00
vis2k
de20998dcf syntax 2021-08-21 13:51:07 +08:00
vis2k
8af6e02420 remove unused 2021-08-21 13:50:04 +08:00
vis2k
d1a7dadb40 syntax 2021-08-21 13:49:43 +08:00
vis2k
69cd7c9d85 syntax 2021-08-21 13:48:18 +08:00
vis2k
b996b52c0f comment 2021-08-21 13:47:23 +08:00
vis2k
1d298fb588 syntax 2021-08-21 13:44:13 +08:00
vis2k
cf42e303ef syntax 2021-08-21 13:43:59 +08:00
vis2k
9cf66b511d syntax 2021-08-21 13:42:02 +08:00
vis2k
e9b86cf085 syntax 2021-08-21 13:41:58 +08:00
vis2k
e32ac5b3db Weaver: ModuleDefinition.ContainsClass extension 2021-08-21 13:39:11 +08:00
vis2k
eff4736f71 syntax 2021-08-21 13:33:18 +08:00
vis2k
63af62affd Weaver: WeaveModule remove unnecessary catch and rethrow 2021-08-21 13:32:56 +08:00
vis2k
d5a8a8b5b5 syntax 2021-08-21 13:31:13 +08:00
vis2k
4a45732fe1 fix 2019 error 2021-08-21 12:43:44 +08:00
vis2k
5b86754042 Weaver as instance class 2021-08-20 22:40:37 +08:00
vis2k
54cc3de33b remove unnecessary parameter 2021-08-20 22:32:15 +08:00
vis2k
a20c7a4c93 Weaver: make more fields private 2021-08-20 22:32:15 +08:00
vis2k
18d472edf7 Readers/Writers: remove static GeneratedCodeClass references 2021-08-20 22:32:15 +08:00
vis2k
98f9dcfc94 ReaderWriterProcessor: remove static GeneratedCodeClass reference 2021-08-20 22:32:15 +08:00
vis2k
f134e0c210 syntax 2021-08-20 22:32:15 +08:00
vis2k
afc82a36a1 NetworkBehaviourProcessor: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
9fe4608532 Writers: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
7762058b86 Resolvers: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
2a1929f7f1 Readers: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
c358358f1d ServerClientAttributeProcessor: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
298a7aef58 SyncVarProcessor: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
dfafd48f08 SyncObjectProcessor: remove static WeavingFailed reference 2021-08-20 22:32:15 +08:00
vis2k
b87096d5c9 MonoBehaviourProcessor: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
64964fb169 MethodProcessor: remove static WeavingFailed references 2021-08-20 22:32:15 +08:00
vis2k
081cd1d92c add comment 2021-08-20 22:32:15 +08:00
vis2k
71eb7cb91d Weaver: group allocations together 2021-08-20 22:32:15 +08:00
vis2k
4ad2af4f74 ReaderWriterProcessor: remove static Readers/Writers state 2021-08-20 22:32:15 +08:00
vis2k
e01a796b47 SyncObjectProcessor: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
9e9b9d3303 ServerClientAttributeProcessor: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
12084f6013 NetworkBehaviourProcessor: remove more static Log references 2021-08-20 22:32:15 +08:00
vis2k
f0747c5418 MethodProcessor: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
b430e29e8b NetworkBehaviourProcessor: remove more static Log references 2021-08-20 22:32:15 +08:00
vis2k
42d33b5b7c NetworkBehaviourProcessor: remove static Log references from all instance methods 2021-08-20 22:32:15 +08:00
vis2k
ce40488f20 MonoBehaviourProcessor: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
3f721c04ae Resolvers: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
21c6bea6b1 SyncVarProcessor: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
7320cd8a2f Writers: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
20405c76f9 Readers: remove static Log references 2021-08-20 22:32:15 +08:00
vis2k
a018f5dc37 Weaver: Logger as interface with MemberReference variants to avoid static Error/Warning methods 2021-08-20 22:32:15 +08:00
vis2k
1da0744875 Weaver: remove Error() function. Use Log.Error to prepare for static removal. 2021-08-20 22:32:15 +08:00
vis2k
7481057418 restore Log class, but as instance 2021-08-20 22:32:15 +08:00
vis2k
9462499c8b rename for consistency 2021-08-20 22:32:15 +08:00
vis2k
55580ba9f3 ProperySiteProcessor: remove static weaverLists references 2021-08-20 22:32:15 +08:00
vis2k
cffc983731 SyncVarProcessor: remove static weaverLists references 2021-08-20 22:32:15 +08:00
vis2k
3ccf9c51f5 NetworkBehaviourProcessor: remove static weaverLists references 2021-08-20 22:32:15 +08:00
vis2k
7101088d40 Writers: remove static weaverTypes references 2021-08-20 22:32:15 +08:00
vis2k
4c6af1ff6f Readers: remove static weaverTypes references 2021-08-20 22:32:15 +08:00
vis2k
00357d119a ReaderWriterProcessor: remove static weaverTypes reference 2021-08-20 22:32:15 +08:00
vis2k
7b205a23bb TargetRpcProcessor: remove static weaverTypes reference 2021-08-20 22:32:15 +08:00
vis2k
5e2a22b71a SyncVarProcessor: remove static weaverTypes reference 2021-08-20 22:32:15 +08:00
vis2k
c89cbd02c5 ServerClientAttributeProcessor: remove static weaverTypes reference 2021-08-20 22:32:15 +08:00
vis2k
3f9c40cafd SyncObjectInitializer: remove static weaverTypes reference 2021-08-20 22:32:15 +08:00
vis2k
cd190de21f NetworkBehaviourProcessor: remove static weaverTypes references 2021-08-20 22:32:15 +08:00
vis2k
133c4bb181 SyncVarProcessor: remove static Weaver.CurrentAssembly references 2021-08-20 22:32:15 +08:00
vis2k
e36b39f328 Weaver: SyncVarProcessor changed to instance class to prepare for non static ILostProcessor 2021-08-20 22:32:15 +08:00
vis2k
6af792e4c5 Extensions: remove Weaver.CurrentAssembly static references 2021-08-20 22:32:15 +08:00
vis2k
f471b85dcb NetworkBehaviourProcessor: remove Weaver.CurrentAssembly static reference 2021-08-20 22:32:15 +08:00
vis2k
2f7ce58dc7 Readers: remove Weaver.CurrentAssembly reference 2021-08-20 22:32:15 +08:00
vis2k
df716572f5 Writers: remove Weaver.CurrentAssembly reference 2021-08-20 22:32:15 +08:00
vis2k
5098868c2a Weaver: Command/Rpc/TargetRpcProcessor: pass WeaverTypes as parameter instead of static access everywhere 2021-08-20 22:32:15 +08:00
vis2k
a7c892cfe1 fix rebase 2021-08-20 22:32:15 +08:00
vis2k
49d8608b7b rename field 2021-08-20 22:32:15 +08:00
vis2k
d996ef23ac comments 2021-08-20 22:32:15 +08:00
vis2k
ed9aa1431c Readers: initialize with AssemblyDefinition to remove static dependency on Weaver 2021-08-20 22:32:15 +08:00
vis2k
0cc0fb92d6 Writers: initialize with AssemblyDefinition to remove static dependency on Weaver 2021-08-20 22:32:15 +08:00
vis2k
b7c186f2b9 Weaver: Readers as non static class 2021-08-20 22:32:15 +08:00
vis2k
5fcf5eb62f Weaver: Writer as non static class 2021-08-20 22:32:15 +08:00
vis2k
0e30d2131c Weaver: static Log class removed. moved into Weaver.LogWarning/ErrorFunc 2021-08-20 22:32:15 +08:00
vis2k
a8668514ce WeaverTypes as non static class 2021-08-20 22:32:15 +08:00
vis2k
fd68a2b69f remove unused import 2021-08-20 22:32:15 +08:00
vis2k
27c09f2973 syntax 2021-08-20 22:32:15 +08:00
vis2k
5f93a7ce7e Weaver: Weave(AssemblyDefinition). WeaveFromFile code moved into CompilationFinishedHook to prepare for ILPP. 2021-08-20 22:32:15 +08:00
vis2k
ba067d30bf syntax 2021-08-20 22:14:03 +08:00
vis2k
cafd560163 WeaverAssembler: use string interpolation 2021-08-20 22:12:56 +08:00
vis2k
b40d9b24b9 WeaverAssembler: use string interpolation 2021-08-20 22:11:58 +08:00
vis2k
ee59bd10df syntax 2021-08-20 22:11:51 +08:00
vis2k
f6c1f8fad3 Weaver: separate WeavingFailed from other Logging 2021-08-19 22:03:39 +08:00
vis2k
9196bd37e1 forgot to rename back 2021-08-19 22:02:39 +08:00
vis2k
9c7c0cdd93 Weaver: separate WeavingFailed from Logging 2021-08-19 21:49:54 +08:00
vis2k
33add82042 Weaver.InvokeRpcPrefix: const instead of static state 2021-08-19 16:00:44 +08:00
vis2k
499cb72173 WeaverLists public 2021-08-19 12:51:54 +08:00
vis2k
28274f707f Weaver: WeaverLists moved into separate file 2021-08-19 12:50:44 +08:00
vis2k
625947a4cf Weaver: remove DLog and DebugEnabled. we never use it to check log files anyway. 2021-08-18 00:58:45 +08:00
vis2k
850d2bbb2b Weaver: remove unnecessary GenerateLogErrors static 2021-08-17 20:41:12 +08:00
vis2k
3c5a9de323 syntax 2021-08-17 17:18:13 +08:00
vis2k
f64b808aed syntax 2021-08-17 17:14:27 +08:00
vis2k
9a07feda28 syntax 2021-08-17 13:24:02 +08:00
vis2k
c80fbab7fa Weaver: use string interpolation instead of string.Format 2021-08-17 13:23:17 +08:00
vis2k
6a62ab9c52 Weaver: remove xml comments 2021-08-17 13:12:49 +08:00
vis2k
d0de7ed92f syntax 2021-08-17 13:09:43 +08:00
vis2k
c63152f71e Weaver: try/catch moved into Weave() to prepare reuse from ILPP 2021-08-17 13:06:49 +08:00
vis2k
2821b34398 Weaver: remove xml comments 2021-08-17 13:04:18 +08:00
vis2k
ab462a598c syntax 2021-08-17 13:01:29 +08:00
vis2k
eb3ac79bd9 Weaver: remove XML comments 2021-08-17 13:01:17 +08:00
vis2k
d329c60899 syntax 2021-08-17 12:58:20 +08:00
vis2k
d1604b5686 syntax 2021-08-17 12:57:08 +08:00
vis2k
950b439035 Weaver: remove XML comment 2021-08-17 12:56:07 +08:00
vis2k
2acc9f77ea Weaver: remove xml comments 2021-08-17 11:53:58 +08:00
vis2k
31babe6b03 Weaver: hooks moved into EntryPoint folder 2021-08-13 18:51:17 +08:00
vis2k
5d2797847e Weaver: Enter-Play-Mode check moved into separate file in Weaver folder 2021-08-13 18:45:07 +08:00
vis2k
ff34a50fdf feat: Expose NetworkEarlyUpdate/NetworkLateUpdate (see #2826) 2021-08-13 11:58:50 +08:00
vis2k
966af93e50 feat: Prevent Nested Network Managers (see #2867) 2021-08-13 11:48:41 +08:00
vis2k
8ca5203262
breaking: NetworkIdentity.spawned split into NetworkServer/Client.Spawned (#2877)
* breaking: NetworkIdentity.spawned split into NetworkServer.Spawned / NetworkClient.spawned.
WIP: 1 failing test

* clear spawned in NetworkClient.Shutdown

* MirrorTest doesn't need to clear spawned anymore. NetworkClient/NetworkServer.Shutdown already do.

* InterestManagement: use NetworkServer.spawned

* NetworkServer: use NetworkServer.spawned

* Match/SceneInterestManagement: use NetworkServer.spawned

* InterestManagementTests: use NetworkServer.spawned

* NetworkIdentity.OnStartServer: use NetworkServer.spawned

* NetworkClient: use NetworkClient.spawned everywhere; and modify OnHostClientSpawn

* NetworkIdentity.spawned: throw if server/client not active to make it more obvious why tests fail

* NetworkBehaviour GetSyncVar functions: use NetworkClient.spawned

* adjust test

* adjust test

* adjust test

* CreateNetworkedAndSpawn functions that return client object too

* adjust test

* adjust test

* adjust test

* adjust test

* adjust tests

* adjust test

* adjust test

* adjust test

* adjust test

* adjust test

* adjust test

* adjust test

* adjust test

* adjust test

* adjust test

* adjust test

* NetworkReader.ReadNetworkIdentity adjusted
2021-08-13 11:20:32 +08:00
vis2k
a13f474243 NetworkReader.ReadNetworkBehaviour: reuse ReadNetworkIdentity 2021-08-12 18:04:20 +08:00
vis2k
4def515c9f SyncVarTest: prepare for .spawned split. this is better. 2021-08-12 15:38:39 +08:00
vis2k
cf3e7acc39 Tests: SyncVarHOokTests improved 2021-08-12 14:24:20 +08:00
MrGadget
33e77d69cb
fix: NT Base OnDrawGizmos only when playing (#2876)
* fix: NT Base OnDrawGizmos only when playing

* Update NetworkTransformBase.cs

Co-authored-by: vis2k <info@noobtuts.com>
2021-08-12 12:25:49 +08:00