Commit Graph

2726 Commits

Author SHA1 Message Date
Paul Pacheco
69161144a0 Fix comments 2020-09-28 21:02:53 -05:00
Paul Pacheco
4a710b2eea Add some comments 2020-09-28 20:44:18 -05:00
Paul Pacheco
86df5954ac Add some comments 2020-09-28 20:32:38 -05:00
Paul Pacheco
3ccb7d9da4
feat: Support recursive data types (#2288)
Remove all the recursionCount nonsense.
This was added to prevent infinite recursion with types that reference themselves.

No need to check anymore, the weaver can generate readers and writers for types that reference themselves such as:

```cs
class Tree {
    Tree child1;
    Tree child2;
}
```

This works by the weaver doing it the way the compiler does: Create a function first, memoize it, then write the body. If the body needs the function, it will get itself and issue a call to itself.
2020-09-28 20:18:56 -05:00
Paul Pacheco
513a0f9945
feat: support null when serializing classes (#2290) 2020-09-28 19:55:29 -05:00
Paul Pacheco
fe641adae8
Refactor writer function generation (#2289) 2020-09-28 17:07:16 -05:00
Paul Pacheco
6fc5a4effc remove TODO comment 2020-09-28 16:43:48 -05:00
Paul Pacheco
7aa47f14be Simplify reader registration 2020-09-28 15:52:36 -05:00
Paul Pacheco
2dc280d292 Refactor reader function generation 2020-09-28 15:50:40 -05:00
Paul Pacheco
fe061ac792 Simplify generated writer name 2020-09-28 15:32:06 -05:00
Paul Pacheco
5e78e27c8f Simplify generated reader name 2020-09-28 15:09:19 -05:00
Paul Pacheco
664d5f7f99
Generate reader and writer functions for enums (#2283)
Currently,  whenever we want to serialize an enum,
we simply serialize the underlying type (byte, short, int)

This works fine,  but in order to get the reader and writer
at runtime I need a function for each type.

With this PR, we generate a reader and writer function for enums too,
the function body simply calls the underlying reader and writer.
2020-09-28 14:51:13 -05:00
James Frowen
fa059b59bf
Squashed (#2187)
* throwing Exception instead of returning null
* re-adding null check until later PR
* removing error from test
* removing extra error
* adding comment
* replacing error with throw for abstact
2020-09-28 21:29:10 +02:00
James Frowen
796aa3baf8
moving WeaverLists functions to WeaverLists (#2285)
The plan is to remove WeaverLists at some point so moving the functions
out of weaver to here for now and then move them closer to where they
are actaully used when we start to remove WeaverLists.
2020-09-28 21:21:30 +02:00
Paul Pacheco
694de7255b Cannot use generics as declared reader and writers 2020-09-28 09:17:33 -05:00
Paul Pacheco
f9ecc64468 Simplify type check 2020-09-28 09:13:25 -05:00
Paul Pacheco
b0d1d9aac0 Rename method for clarity 2020-09-28 08:52:15 -05:00
Paul Pacheco
59566588b1 Simplify type check 2020-09-28 07:39:03 -05:00
Paul Pacheco
54f96309da Simplify type check 2020-09-28 07:38:24 -05:00
vis2k
9077cc7fd7 Add comments 2020-09-27 18:51:23 +02:00
James Frowen
8b3e509c3b
Update Transport.cs 2020-09-23 16:52:11 +01:00
James Frowen
bdd81e33ba
fix: fixing new import
see https://github.com/vis2k/Mirror/pull/2259
2020-09-23 16:30:32 +01:00
Paul Pacheco
a0aecf11fb Linting 2020-09-22 13:07:03 -05:00
Paul Pacheco
25b2fa9af8 KISS 2020-09-22 13:03:33 -05:00
Paul Pacheco
c868561822 Remove passthrough method 2020-09-22 12:49:38 -05:00
Paul Pacheco
3fec9ec880 Remove static weaver state 2020-09-22 12:33:48 -05:00
Paul Pacheco
116336fbf1 Remmove passthrough method 2020-09-22 12:33:18 -05:00
Paul Pacheco
3d331b4c61 Simplify set initialization 2020-09-22 12:21:58 -05:00
Paul Pacheco
34fa002099 Remove comment that does not apply 2020-09-22 12:20:37 -05:00
Paul Pacheco
a126bfd4dd Simplify method signature 2020-09-22 11:56:54 -05:00
Paul Pacheco
fdc21582db simplify module weaving 2020-09-22 11:45:31 -05:00
Paul Pacheco
e79ffeaa8e Use string interpolation 2020-09-22 11:40:13 -05:00
Paul Pacheco
b113fd4ecf KISS 2020-09-22 11:23:24 -05:00
Paul Pacheco
6c7e578d5a Remove redundant validations 2020-09-22 11:22:36 -05:00
Paul Pacheco
3e8870f791 we only weave one assembly at a time, no need for array 2020-09-22 10:11:07 -05:00
Paul Pacheco
eaf6ac66f0 output directory is always null, no need to pass it around 2020-09-22 10:06:13 -05:00
Paul Pacheco
eadb029393 Rename methods for clarity 2020-09-22 09:53:23 -05:00
Paul Pacheco
9d7c9069d7 Simplify namespace 2020-09-22 08:17:06 -05:00
Paul Pacheco
0fbcefe8df Follow naming convention 2020-09-22 08:16:04 -05:00
Paul Pacheco
85d26ebce6 type safe type comparison 2020-09-21 23:00:30 -05:00
Paul Pacheco
541b516d60 Remove unused parameter 2020-09-21 17:09:13 -05:00
Paul Pacheco
030dc86ea9 Namespace simplifications 2020-09-21 17:08:46 -05:00
Paul Pacheco
12debf1c8c Simplify namespace 2020-09-21 17:05:20 -05:00
Paul Pacheco
f77186e1d1 Simplify namespace 2020-09-21 17:00:57 -05:00
Paul Pacheco
d123e03915 Simplify namespace 2020-09-21 17:00:10 -05:00
Paul Pacheco
8fcbba50c4 Remove unused parameter 2020-09-21 16:59:05 -05:00
Paul Pacheco
7347e5700d Remove unused parameter 2020-09-21 16:58:33 -05:00
Paul Pacheco
76ce3796eb Simplify attribute namespace 2020-09-21 16:58:08 -05:00
Paul Pacheco
ca418457e8 Simplify guard check 2020-09-21 16:57:22 -05:00
Paul Pacheco
65f6e42b53 Simplify namespaces 2020-09-21 16:53:01 -05:00
James Frowen
94419ba003
Update ApiConnector.cs
adding null check for when listserver fails to be created
2020-09-20 00:44:13 +01:00
James Frowen
44401ab3bf
Update NetworkHeadlessLogger.cs 2020-09-19 11:30:41 +01:00
vis2k
d559bcfea7 Icon updated to half M 2020-09-19 10:01:10 +02:00
Paul Pacheco
07d290fd8c
Enhance code readability by using extension method (#2260)
# Before

This is hard to read:
```
if (ca.AttributeType.FullName == typeof(Mirror.CommandAttribute).FullName) {
...
}
```

# After

```
if (ca.AttributeType.Is<Mirror.CommandAttribute>()) {
...
}
```
2020-09-18 14:54:51 -05:00
James Frowen
7919942110
Splitting up test function
* Update NetworkServerTest.cs

splitting up test

* Update NetworkServer.cs

using string interpolation
2020-09-18 20:47:54 +01:00
Paul Pacheco
e50ea6318f
perf(weaver): No need to manually load mirror and unity assemblies (#2261) 2020-09-18 14:32:14 -05:00
James Frowen
a573bccc79
Update ApiUpdater.cs 2020-09-18 20:14:10 +01:00
Paul Pacheco
0b5989f87d Move overloads together 2020-09-18 13:06:34 -05:00
Paul Pacheco
6cfdd6469a
Simplify type lookup in weaver (#2258)
# 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.
2020-09-18 13:05:16 -05:00
James Frowen
8dac53ce3c
making InvokeUserCode use correct type in argument (#2259) 2020-09-17 22:41:37 +01:00
James Frowen
c69d8cca0b
flip equals to return early (#2245)
* flip equals to return early

* flip equals to return early

* removing un-needed comment
2020-09-16 12:05:43 +01:00
James Frowen
23bd9559d3
pref: increasing performance when Send is called on no observers (#2244)
* pref increasing performance when sending to no observers

* pref increasing performance when sending to no observers
2020-09-16 10:32:16 +02:00
James Frowen
5eb5ff6601
fix: fixing NullReferenceException when loading scene (#2240)
* 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
2020-09-16 10:30:10 +02:00
James Frowen
7580e9a6f5
Update ClientScene.cs (#2250)
* Update ClientScene.cs

Improving logging
- making sure sceneId is always hex
- only logging "Client spawn for ..." if it was successful

* Update ClientSceneTests_OnSpawn.cs
2020-09-14 22:35:41 +01:00
James Frowen
833c329ab2
Update ApiUpdater.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
2020-09-14 21:58:33 +01:00
James Frowen
b4fea1bfa3
Update NetworkServer.cs (#2247) 2020-09-13 19:07:59 +01:00
James Frowen
aec9b8a2ec
Update NetworkIdentity.cs
fixing block not being in remarks
2020-09-13 15:44:25 +01:00
James Frowen
d5c2387d1d
Update SyncObject.cs 2020-09-13 14:33:32 +01:00
James Frowen
ae9d2e35a9
docs: adding debug notes on list server (#2246) 2020-09-13 02:47:57 +01:00
James Frowen
844904dae5
adding doc comment (#2243) 2020-09-13 01:54:23 +01:00
James Frowen
94da8aec34
fix: Fixing IndexChanged hook not being called for NetworkRoomPlayer (#2242)
* adding Server to make sure index is only changed on the server

* removing calls to RecalculateRoomPlayerIndices on client
2020-09-13 01:52:32 +01:00
James Frowen
0c78fa0d7a
making sure CallOnClientExitRoom is called when object is disabled/destroyed (#2241) 2020-09-12 23:36:46 +01:00
Paul Pacheco
992129e5b6 Simplify string interpolation 2020-09-12 09:04:52 -05:00
James Frowen
5edba81dee
fix: ClientScene.localplayer is now set to null when it is destroyed (#2227)
* 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
2020-09-08 09:45:24 +02:00
James Frowen
2033f7d009
breaking: Removing manual invoke for Cmd and RPC (#2223)
* 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
2020-09-06 16:14:05 +02:00
vis2k
a30e8fcd85 adding empty SyncEventProcessor file for deleted file 2020-09-06 16:07:52 +02:00
James Frowen
a232c539a7 adding empty program file for deleted file 2020-09-06 16:05:50 +02:00
James Frowen
bfa482fde7
Adding Network Lerp Rigidbody docs and change log (#2226)
* adding NetworkLerpRigidbody to change log

* adding docs for  Network Lerp Rigidbody
2020-09-05 13:09:06 +01:00
James Frowen
f326999d50
removing methods that only set enum (#2221) 2020-09-04 22:41:38 +01:00
James Frowen
622b52124b
Refactoring handle remote call (#2222)
* using string interpolation for logs

* return early instead of if/else
2020-09-04 22:40:56 +01:00
James Frowen
eac69ab5f6
docs: sync event obsolete (#2216)
* 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
2020-09-04 16:29:46 +01:00
vis2k
e67cef6666
Remove ScriptTemplates to clean up folder (#2213)
* Remove ScriptTemplates to clean up folder

* Update main.yml

Removing script templates from CI

Co-authored-by: James Frowen <jamesfrowendev@gmail.com>
2020-09-04 07:55:11 +02:00
James Frowen
24e3ea099c
adding version define from v18 breaking change (#2214) 2020-09-03 15:46:15 +01:00
James Frowen
e79e340e0d
fixing typo in NetworkIdentity.cs 2020-09-03 11:51:05 +01:00
vis2k
cd3d9c2144 Delete old file 2020-09-03 09:05:47 +02:00
vis2k
fc1096d66c
breaking: Removed [SyncEvent] because ClientRpc/TargetRpc does the same thing, and it's an enormous effort to support the Weaver code. (#2178) 2020-09-03 09:04:29 +02:00
James Frowen
ad8af783dc
Replacing prefabAssetPath with assetPath for PrefabStage to stop warning (#2210) 2020-09-03 08:48:06 +02:00
James Frowen
1ade82d435
feat: making NetworkBehaviour.IsDirty public (#2208) 2020-08-31 12:26:50 +01:00
James Frowen
5701369e84
feat: adding script to help debug list server (#2202)
Script uses OnGui so can be used to check if server has been added to list server
2020-08-27 23:15:43 +01:00
James Frowen
fc530782cc
fix: fixing width and layout group on cloud example (#2201) 2020-08-27 23:10:11 +01:00
vis2k
f6dbf8c19e Fix broken Weaver test 2020-08-27 00:18:01 +02:00
vis2k
594aec45bf Weaver RpcProcessor validation moved to NetworkBeahviourProcessor.ProcessClientRpc 2020-08-26 13:15:23 +02:00
vis2k
25ef6ac36a Weaver TargetRpcProcessor validation moved to NetworkBehaviourProcessor.ProcessTargetRpc 2020-08-26 13:13:56 +02:00
vis2k
820d0daa29 Weaver CommandProcessor validation moved to NetworkBehaviourProcessor.ProcessCommand 2020-08-26 13:12:56 +02:00
vis2k
5e7257d7bc Weaver ValidateRemoteCallAndParameters IsStatic check added so we don't need to check in Command/Rpc/TargetRpcProcessors 2020-08-26 13:11:56 +02:00
vis2k
2e178b7eaf Weaver NetworkBehaviourProcessor: ValidateRemoteCallAndParameters function added to be used from Command/Rpc/TargetRpcProcessors 2020-08-26 13:08:46 +02:00
vis2k
fbad5d2401 Add comment 2020-08-26 13:04:39 +02:00
vis2k
68ebaf1756 Weaver TargetRpcProcessor: ValidateTargetRpc simplified 2020-08-26 13:03:44 +02:00
vis2k
e6ffe6d6bf Weaver: Simplify ValidateParameters 2020-08-26 13:02:25 +02:00
vis2k
ce3dd51d81 Weaver NetworkBehaviourProcessor: ProcessMethodsValidateParameters renamed to ValidateParameters 2020-08-26 13:01:43 +02:00
vis2k
ee8ad1d750 Weaver TargetRpcProcessor: ProcessMethodsValidateTargetRpc renamed to ValidateTargetRpc 2020-08-26 13:01:43 +02:00
vis2k
1b49a21d49 Weaver RpcProcessor: ProcessMethodsValidateRpc renamed to ValidateRpc 2020-08-26 13:01:43 +02:00
vis2k
9131586f5c Weaver NetworkBehaviourProcessor: ProcessMethodsValidateFunction renamed to ValidateFunction 2020-08-26 13:01:43 +02:00
vis2k
3dab0ec7c5 Weaver CommandProcessor: ProcessMethodsValidateCommand renamed to ValidateCommand 2020-08-26 13:01:43 +02:00
James Frowen
a9d21ea9ab
fix: adding error for generated read writer for abstract class (#2191)
* 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
2020-08-25 17:14:39 +01:00
James Frowen
c9a9f92c7c
commenting out reader error checks (#2196)
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
2020-08-25 01:39:03 +01:00
James Frowen
d73de03eca
renaming variables in Readers to match writers (#2195) 2020-08-24 14:48:15 +01:00
James Frowen
11a8d41464
fixng ArgumentNullException (#2193) 2020-08-24 14:43:51 +01:00
James Frowen
771f1fea13
fixing typo (#2192)
variable should start with lower case
2020-08-23 19:30:20 +01:00
James Frowen
1045b1f2ed
tests using HasError (#2188)
* 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
2020-08-22 20:20:16 +01:00
James Frowen
bd7c93674e
Error with message overloads (#2168)
* weaver error with message overloads

* finding method with 1 arg
2020-08-22 21:07:33 +02:00
James Frowen
d5d434cf13
weaver: renaming variables and changing order things happen (#2172)
* renaming variables

* adding todo

* moving order that things happen
2020-08-22 21:05:01 +02:00
James Frowen
ea0b9e1215
returning lists instead of passing them in as args (#2183) 2020-08-22 20:51:47 +02:00
James Frowen
f051c4b911
Simplify weaver tests (#2186)
* Simplifying weaver test files

* updating error messages
2020-08-22 19:00:11 +01:00
James Frowen
c312874bcb
renaming test folder in order to use WeaverTestsBuildFromTestName (#2189) 2020-08-22 18:59:06 +01:00
James Frowen
f1d7f207c3
adding HasError method (#2185)
Makes it easier to write error message within weaver tests because there is mess syntax to worry about
2020-08-22 16:23:56 +01:00
vis2k
9ec5eadd51 Weaver: PropertySiteProcessor.ProcessSitesModule renamed to Process for consistency 2020-08-22 13:59:17 +02:00
vis2k
ed60e592dc Syntax 2020-08-22 13:57:52 +02:00
vis2k
16f8f05abe Weaver: ReaderWriterProcessor.ProcessReadersAndWriters renamed to Process for consistency 2020-08-22 13:56:52 +02:00
vis2k
84602aace6 ServerClientAttributeProcessor: ProcessSiteClass renamed to Process for consistency 2020-08-22 13:55:22 +02:00
vis2k
342ed13f55 Weaver: update ServerClientAttributeProcessor explanation 2020-08-22 13:40:41 +02:00
vis2k
427adf6c8e Weaver: ProcessNetworkBehaviourType code moved into NetworkBehaviourProcessor.Process 2020-08-22 13:40:41 +02:00
James Frowen
4774f83032
moving FindSyncObjectsFields to its own function (#2182) 2020-08-22 12:10:01 +02:00
vis2k
df38c4fb2c Syntax 2020-08-21 20:00:42 +02:00
vis2k
5cc908a18d Weaver PropertySiteProcessor: remove redundant AssemblyDefinition parameter. Weaver passes assembly.MainModule anyway. 2020-08-21 18:25:01 +02:00
vis2k
4258220b26 Weaver PropertySiteProcessor: pass CurrentAssembly to Process function to reduce coupling 2020-08-21 18:22:12 +02:00
vis2k
7b9066832b Syntax 2020-08-21 18:04:32 +02:00
vis2k
fe32557a38 Weaver ProcessSyncVars: remove redundant numSyncVars field, use syncVars.Count instead 2020-08-21 17:33:11 +02:00
vis2k
54c32227bd
[Obsolete] SyncEvent (#2180) 2020-08-21 17:03:06 +02:00
James Frowen
eec49fafce
feat: Use Server Client attribute outside of NetworkBehaviour (#2150)
* 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
2020-08-21 16:02:37 +01:00
James Frowen
c6fa49c72a
fix: adding version define from v17 breaking change 2020-08-21 13:49:54 +01:00
vis2k
35d8e0ed60 Syntax 2020-08-21 12:12:40 +02:00
vis2k
07f5912215 Weaver GenericArgumentResolver: reuse StripGenericParametersFromClassName 2020-08-21 12:07:18 +02:00
vis2k
0e124ff8b2 Weaver Resolvers: remove unused code 2020-08-21 12:02:01 +02:00
vis2k
bfb97e7202 Syntax 2020-08-21 11:54:49 +02:00
vis2k
2ea787f4fc Weaver Extensions: HasCustomAttribute uses Linq to simplify code 2020-08-21 11:38:36 +02:00
vis2k
467d9e834f Weaver Extensions: GetMethod uses Linq to simplify code 2020-08-21 11:38:36 +02:00
vis2k
045b50a929 Weaver Extensions: GetMethods uses Linq to simplify code 2020-08-21 11:31:25 +02:00
vis2k
687c9002dd typo 2020-08-21 11:28:51 +02:00
vis2k
0043288900 typo 2020-08-21 11:28:38 +02:00
vis2k
e8ae2246c0 Weaver Extensions: remove unused functions 2020-08-21 11:27:11 +02:00
vis2k
22486885f1 syntax 2020-08-21 11:21:26 +02:00
vis2k
948b97e30d Weaver Tests: StripGenericParametersFromClassNameTest 2020-08-21 11:20:31 +02:00
vis2k
ad42aa19de internal 2020-08-21 11:18:05 +02:00
vis2k
3b6f98be9f Weaver Extensions: IsDerivedFrom strip generic parameters code moved into separate function 2020-08-21 11:16:05 +02:00
vis2k
461396601f ignore warnings 2020-08-21 11:07:08 +02:00
James Frowen
c39a2d546e
splitting up GetWriteFunc function (#2171) 2020-08-21 10:57:41 +02:00
James Frowen
150b14a2ed
perf: adding check for no connections (#2130)
* 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
2020-08-21 10:51:58 +02:00
James Frowen
7c7edb2586
weaver: Moving stuff around in writer (#2170)
* removing TypeDef versions of extension methods

* moving function up

* Renaming function

* fixing comment

* changing comment

* Update Writers.cs

Co-authored-by: vis2k <info@noobtuts.com>
2020-08-20 22:35:57 +02:00
James Frowen
99d4f8c9bd
breaking: replacing isHeadless with isServerBuild (#2093)
* 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
2020-08-20 13:56:46 +02:00
James Frowen
a2124c3522
Renaming tests and namespaces (#2167)
* renaming test

* renaming test file

* removing test suffix from methods

* changing test namesapce
2020-08-19 02:18:20 +01:00
James Frowen
0c790e339d
adding assert to make sure transport is set (#2164)
* 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
2020-08-18 18:57:31 +02:00
James Frowen
3a276b4e30
fix: weaver test for abstract methods (#2166)
* 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
2020-08-18 18:56:48 +02:00
James Frowen
7294c42798
splitting up ProcessEvents function (#2174) 2020-08-18 18:56:21 +02:00
James Frowen
e4d9304478
moving getwriter to above op code (#2175) 2020-08-18 18:54:35 +02:00
James Frowen
901898e897
removing old tests (#2165)
these are covered by CollectionWriterTests.gen.cs
2020-08-17 12:01:33 +01:00
James Frowen
aa49c54dd0
removing program class (#2161) 2020-08-16 12:22:12 +02:00
James Frowen
381e5a115b
feat: allowing lists to automatically be sent in Commands, Rpc, and Messages (#2151)
* 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
2020-08-15 18:00:55 +02:00
James Frowen
5b179e8917
Generated tests for collection read write (#2158)
* 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
2020-08-15 02:57:38 +01:00
James Frowen
2fbd131f61
Test for array segment and writers (#2157)
* tests for array and segment writers

* fix typo
2020-08-14 23:29:07 +01:00
James Frowen
c1410b0924
fix: adding error when Server/Client is used on abstract methods (#1978)
* 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
2020-08-14 10:52:06 +02:00
James Frowen
71bf792db5
moving where CallOnClientEnterRoom is called (#1922) 2020-08-14 10:47:44 +02:00
James Frowen
fc48e0ecf9
Adding alternative to NetworkRigidbody (#2123)
Uses Lerp to set position and velocity
2020-08-11 10:27:09 +02:00
James Frowen
2046e8813e
removing Internal functions that do nothing (#2154) 2020-08-10 08:57:47 +02:00
James Frowen
5089546ecd
fixing IL error when using floats (#2147)
* fixing IL error when using floats

* removing speical case for primitive types
2020-08-09 21:11:46 +01:00
James Frowen
e4a5ce795b
fix: Nested messages (#2148)
* test for nested messages

* fixing StackOverflow with nested types
2020-08-09 20:01:14 +02:00
James Frowen
fe3bebcc63
Making EnableDebugMode public (#2152) 2020-08-09 17:29:05 +01:00
James Frowen
ee9a600f66
Generated attribute tests (#2149)
* 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
2020-08-08 15:11:31 +01:00
James Frowen
ec54ee6d8c
fix: fixing unity crash on StackOverflowException (#2146)
StackOverflowException was causing unity to crash while running weaver 
tests, using inner exception seems to fix that issue
2020-08-07 16:30:08 +01:00
James Frowen
ddc6139725
fix: fixing warning message for client attribute (#2144) 2020-08-07 13:03:46 +01:00
James Frowen
d46469a79c
fix: isServer false in OnDestroy (#2101)
* fix isServer false in OnDestroy

* making sure that OnDestroy doesn't call Destroy again
2020-08-06 17:55:35 +02:00
James Frowen
a124f3f439
fix: fixing cloud log not using logger (#2141) 2020-08-06 13:26:14 +01:00
Keir Smith
23b9fb0214
feat: Added Layer Weight to NetworkAnimator (#2134)
* 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>
2020-08-05 23:54:46 +01:00
James Frowen
87a96d17ca
deleting telepathy tests (#2136) 2020-08-05 20:44:38 +02:00
James Frowen
fee9adfa63
Adding asmdef to telepathy (#2137)
* 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
2020-08-05 12:40:10 +01:00
James Frowen
2998295e45
adding asmdef to websockets (#2135) 2020-08-05 12:09:00 +02:00
James Frowen
17838c5b52
removing 2nd null check (#2128)
if identity is not null then the game object is also not null
2020-08-05 12:08:20 +02:00
James Frowen
2b6a1bb792
adding test for NetworkServer.Destroy (#2115) 2020-08-05 12:07:40 +02:00
vis2k
0f09702062
Weaver types moved into WeaverTypes, and reduce some global state (#2138) 2020-08-05 12:07:11 +02:00
James Frowen
f1e5878ca1
Test for OnSpawn (#2004) 2020-08-04 11:55:42 +01:00
James Frowen
067c46fd60
fixing doc links (#2139) 2020-08-03 22:11:38 +01:00
James Frowen
4adaac8867
moving 2nd if inside 1st (#2127) 2020-08-03 20:37:32 +02:00
James Frowen
c63811ddc4
correctly error message so they are not misleading (#2124) 2020-08-03 20:36:20 +02:00
James Frowen
03fd6a5526
splitting on spawn into functions (#2113)
* making ApplySpawnPayload internal for tests

* splitting on spawn into functions

* renaming
2020-08-03 20:35:51 +02:00
James Frowen
7604e65c2c
fix: making triggers be called right away instead on owner (#2125)
* making triggers be called right away instead on owner

* only handling on server if it is not the host
2020-08-03 20:34:52 +02:00
James Frowen
da629e5f71
Formatting doc comments (#2131)
* making comments in NetworkServer doc comments

* making comments in NetworkIdentity doc comments
2020-08-03 20:33:42 +02:00
James Frowen
c3765c101d
moving FakeNetworkConnection to its own file (#2132) 2020-08-02 23:11:03 +01:00
James Frowen
3f027e0d0a
using memory transport in test (#2129)
telepathy fails this test sometimes
2020-08-02 23:00:14 +01:00
linjmeyer
3bdfd451cb
SSL/TLS version in Websockets now configurable (#2121) 2020-08-01 09:36:17 -05:00
Paul Pacheco
890ee6b58d
fix: auto fill serialize/deserialize for classes (#2120)
Note this method is being called in 3 places:
one in MessageClassProcessor and 2 in NetworkBehaviorProcessor.

The NetworkBehaviorProcess is really a don't care, this condition cannot happen since it would not be invoked unless the class extends from NetworkBehavior. In this case, it will always resolve.
but even if it does not resolve, they handle the null case gracefully by not calling the base method.

MessageClassProcessor also calls this method, and if it is null it does not call the base method. That is precisely the behavior we want to resolve #2117

so all 3 places are perfectly fine receiving null.

The only way to trigger the error was #2117

I renamed the method to make it clearer that this may not find the method in the parent class.
2020-08-01 08:46:12 -05:00
vis2k
0cb84baf97 Benchmark example missing NetworkManager reference fixed 2020-07-30 19:59:11 +02:00
vis2k
2effa7bc02 Update readme for 2018.4 LTS 2020-07-30 19:36:46 +02:00
vis2k
ce8d540a8f 2k NetworkTransforms renamed to Benchmark 2020-07-30 19:24:05 +02:00
vis2k
7de5400ad5 10k Benchmark removed because it's 2D, outdated and insignificant 2020-07-30 19:23:25 +02:00
vis2k
6f645c870c Benchmark monster mesh changed to cube to reduce polygons 2020-07-30 19:21:50 +02:00
vis2k
0a554f5f6c Remove warning 2020-07-30 19:12:15 +02:00
Anastasios Andronidis
92bc3c3150
Improve Telepathy debug messages (#2106) 2020-07-28 18:45:00 +01:00
James Frowen
70b7211cba
docs: updating cloud readme (#2111) 2020-07-28 00:41:45 +01:00
James Frowen
e136f48101
feat: Adding Custom Data and Custom Address fields to list server (#2110)
* whitespace

* adding doc comment
2020-07-27 17:31:56 +01:00
James Frowen
f913c64610
adding customData and customAddress (#2108) 2020-07-27 01:22:12 +01:00
francescoStrada
049ec99aa7
changing serverBroadcastListenPort variable access permissions to protected (#2103) 2020-07-23 11:12:36 +02:00
uwee
df16a7d3cc
fix: dont allow set of networkSceneName directly (#2100) 2020-07-19 16:58:35 +02:00
James Frowen
9497886ad4
fixing angularVelocity sync (#2098) 2020-07-16 01:29:24 +01:00
James Frowen
8e545ac468
fix: fixing cloud scripts not pinging api (#2097)
* adding logs to api updater

* fixing cloud api
2020-07-15 16:07:39 +01:00
uwee
e4cc85c413
fix: Misc code smells (#2094)
* fix: code smell - condensed if statement

* fix: code smell - dont throw generic Exception
2020-07-14 18:44:52 +02:00
uwee
12827f65a9
fix: add NetworkManager.StartClientUri test (#2095) 2020-07-14 18:44:28 +02:00
James Frowen
984eb73ea4
fix: register prefab error with same guid (#2092)
* tests for when newassetId is same as current

* stopping error if ids are the same

* invert if and adding comment
2020-07-13 19:40:11 +01:00
Paul Pacheco
a219ff2059
encapsulate method substitute naming (#2091)
* encapsulate method substitute naming

* This const is not used anywhere else,  make it private

Co-authored-by: Paul Pacheco <paul.pacheco@aa.com>
2020-07-13 13:25:54 +01:00
James Frowen
18d695744f
fix: renaming call/invoke prefix for SyncEvent (#2089)
* renaming sync event

same reason as #2088

* removing un-used const
2020-07-13 06:29:24 -05:00
James Frowen
64f663fb5e
adding prefix to call command and rpc (#2088)
now that Cmd is not required "Call..." might collide with user functions
2020-07-13 05:49:27 -05:00
James Frowen
f1698e658c
removing code that isnt needed (#2090)
we use the original method name so we do not need to remove the prefix
2020-07-13 04:44:51 -05:00
James Frowen
ef47ee7a57
feat: Rigidbody example (#2076)
* adding example for NetworkRigidbody

* adding hud

* adding empty player so that scene objects spawn

* turning off debug logs
2020-07-13 01:04:51 +01:00
Paul Pacheco
ed40c2d210
feat: Sync Events no longer need Event prefix (#2087)
Instead of doing
```cs
[SyncEvent]
public event MySyncEventDelegate EventOnly;
```

You can now do
```cs
[SyncEvent]
public event MySyncEventDelegate Only;
```

We actually tried to remove them a while ago. The way the weaver worked
back then caused an infinite recursion.

Since the Command rewrite that allows virtuals, this is no longer
a problem.  So we can drop this requirement.

Co-authored-by: Paul Pacheco <paul.pacheco@aa.com>
2020-07-12 17:27:44 -05:00
Paul Pacheco
eb93c34b33
feat: ClientRpc no longer need Rpc prefix (#2086)
Instead of doing
```cs
[ClientRpc]
public void RpcPepe() {}
```

You can now do
```cs
[ClientRpc]
public void Pepe() {}
```

We actually tried to remove them a while ago. The way the weaver worked
back then caused an infinite recursion.

Since the Command rewrite that allows virtuals, this is no longer
a problem.  So we can drop this requirement.

Co-authored-by: Paul Pacheco <paul.pacheco@aa.com>
2020-07-12 16:50:01 -05:00
Paul Pacheco
d89ac9fb05
feat: TargetRpc no longer need Target prefix (#2085)
Instead of doing
```cs
[TargetRpc]
public void TargetPepe() {}
```

You can now do
```cs
[TargetRpc]
public void Pepe() {}
```

We actually tried to remove them a while ago. The way the weaver worked
back then caused an infinite recursion.

Since the Command rewrite that allows virtuals, this is no longer
a problem.  So we can drop this requirement.

Co-authored-by: Paul Pacheco <paul.pacheco@aa.com>
2020-07-12 16:49:45 -05:00
Paul Pacheco
b6d1d09f84
feat: Commands no longer need Cmd prefix (#2084)
Instead of doing
```cs
[Command]
public void CmdPepe() {}
```

You can now do
```cs
[Command]
public void Pepe() {}
```

We actually tried to remove them a while ago. The way the weaver worked
back then caused an infinite recursion.

Since the Command rewrite that allows virtuals, this is no longer
a problem.  So we can drop this requirement.

Co-authored-by: Paul Pacheco <paul.pacheco@aa.com>
2020-07-12 16:49:35 -05:00
James Frowen
110e8f162a
increasing max fails to 15, and ping interval to 20 (#2081)
ping will only stop if can not get success from cloud for 5 mins
2020-07-09 23:30:58 +01:00
James Frowen
f717945525
fix: not removing server if id is empty (#2078)
* logging error message

* not removing server if ID is empty
2020-07-07 21:20:08 +01:00
Walter Geisler
47740f0a46
Refactor TimeoutAuthenticator to pass through client/server start callbacks (#2074)
* Update TimeoutAuthenticator.cs

* Moved listener passthrough back to Awake()

* Remove white space above Awake()

* Remove all white space above awake
2020-07-06 16:06:37 +01:00
James Frowen
0506ad5ea1
fixing cloud tank example (#2069) 2020-07-06 09:37:30 +01:00
James Frowen
e7ca6eb7ef
tests for struct message with empty function (#2067) 2020-07-05 01:04:33 +01:00
James Frowen
3418fa2106
fix: Message base class not being Serialized if processed in the wrong order (#2023)
* finding all fields

* adding test for message with base

* undoing FindAllPublicFields

* adding tests for Inheritance with define order

* making sure that messages are processed in order

do not need to check if message has already been processed becuase
OnSerialize is only added/changed if it is missing or empty

* removing un-needed comments

* using recursion instead of loops

* remove white space
2020-07-05 01:04:14 +01:00
Paul Pacheco
264f9b8f94
perf: Use invokeRepeating instead of Update (#2066)
* perf: Use invokeRepeating instead of Update

If you have low frequency calls, InvokeRepeating is a lot faster than
Update().  Use InvokeRepeating for NetworkProximityChecker

* Fix indentation

Co-authored-by: Paul Pacheco <paul.pacheco@aa.com>
2020-07-04 13:41:16 -05:00
James Frowen
999c8b1c32
fixing doc comment 2020-07-03 22:53:30 +01:00
James Frowen
57bc80c9cd
adding clientAuthority to commands (#2064) 2020-07-03 16:31:42 +01:00
James Frowen
c278c004f6
updating readme for cloud list server (#2058) 2020-07-01 16:20:24 +01:00
James Frowen
b316b35d46
fix: weaver now processes multiple SyncEvent per class (#2055)
* weaver test for mutlitple events

* tests for multiple sync events in 1 class

* removing break so that multiple events will be proccessed

It seems like this break was here because unet used foreach CustomAttributes
but mirror uses GetCustomAttribute
2020-06-30 09:59:18 +02:00
James Frowen
c91308fb04
fix: sync events can not have the same name if they are in different classes (#2054)
* test for sync event with same name

* using full name instead of name

* fix test
2020-06-30 09:58:50 +02:00
James Frowen
d0bb9d57b0
sending if syncInterval is greater or equal to 0 (#2053) 2020-06-30 09:56:13 +02:00
MaZy
4ffff192a6
fix: If socket is undefined it will return false. See #1486 (#2017) 2020-06-28 18:10:17 -05:00
James Frowen
61d44b2d80
fix: Fallback and Multiplex now disable their transports when they are disabled (#2048)
* test to check if fallbacks disables other transport

* using ondisable to disable other transport

* fixing teardown

* adding test for Multiplex

* using ondisable to disable other transport

* fixing NSubstitute for 2019
2020-06-28 23:49:36 +01:00
James Frowen
ab1b92f74b
fix: addingNetwork rigidbody icon and AddComponentMenu attribute (#2051)
* adding icon

* adding attributes

* adding docs

* adding disclaimer at top of doc
2020-06-28 23:47:50 +01:00
James Frowen
0c30d3398a
fix: Network rigidbody fixes (#2050)
* using syncInterval for client auth

* only set sync var if change is greater than Sensitivity

* fixing client auth sync

* using currentVelocity
2020-06-28 23:46:43 +01:00
James Frowen
25285b1574
feat: Experimental NetworkRigidbody (#1822)
* NetworkRigidBody
2020-06-27 00:38:50 +01:00
Kyle
ba29119aa1
Missed one internal call that the NetworkManager uses (#2044) 2020-06-27 00:35:58 +01:00
Eunseop Shim
350ce47db3
Implement IReadOnlyDictionary for SyncDictionaries (#2032) 2020-06-26 13:21:54 +02:00
Kyle
d06ee6a21d
Kr/issue 2039 (#2040)
* Update NetworkClient.cs

* Update NetworkServer.cs

* Missed a call
2020-06-26 13:18:56 +02:00
James Frowen
78bd284b6f
fixing null ref (#2043) 2020-06-26 09:47:49 +01:00
James Frowen
e36449cb22
fix: changing namespace to match folder name (#2037)
* updating namespace

* updating example name spaces
2020-06-25 16:13:47 +01:00
James Frowen
7c9afca7c5
deleting old list server (#2034)
* deleting old list server

* fixing prefab name
2020-06-25 16:23:09 +02:00
James Frowen
18691dabe0
adding game name to api updater (#2036) 2020-06-25 12:14:50 +01:00
James Frowen
7d0e907b73
feat: More examples for Mirror Cloud Service (#2029)
* fixing pong spawn points

* renaming files and asmdef

* More Cloud examples

* Moving pong example to cloud folder
* Moving shared code to GUI folder
* Adding readme for examples
* Adding tank example
2020-06-25 01:58:47 +01:00
James Frowen
54a69bbc83
Fixing warning messages (#2030)
* disabling warning for empty method

* removing null propagation

null propagation in untiy can cause MissingReferenceException
2020-06-24 23:13:12 +02:00
James Frowen
b42c74bc40
adding doc comment for SpawnMessag (#2027) 2020-06-24 23:12:00 +02:00
James Frowen
f1fdc959dc
feat: adding demo for mirror cloud services (#2026)
* adding mirror list services

* fixing code smells

* removing runtime example folders

* removing matchmaking code till feature is ready

* fixing scene path

* updating readme to say where example is
2020-06-23 20:39:38 +02:00
James Frowen
065d320208
calling animator.enabled before calls to animator (#2000)
some functions don't need this check as the check is done before they are called
2020-06-21 12:09:24 +02:00
James Frowen
296f6f9cd8
Only setting last parameters values if they have changed (#1999)
* only setting last values if they have changed

* adding comment
2020-06-21 12:06:37 +02:00
James Frowen
f18f7a5c3d
making sure that trigger is called on the server (#1998) 2020-06-21 12:06:07 +02:00
James Frowen
3bea342257
rethrow error with stack (#2013)
this will help error be more useful
2020-06-21 11:54:11 +02:00
James Frowen
a05df81127
adding if before starting task (#2021) 2020-06-21 11:52:32 +02:00