-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow for generic NetworkBehaviors (#519)
This would allow network behaviours to be used together with generics. It doesn't allow for the generic to be used in a syncvar or RPC methods. Also removed Test that checks if generic behaviours are blocked.
- Loading branch information
Showing
11 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ts/Editor/Weaver/WeaverNetworkBehaviourTests~/NetworkBehaviourClientRpcGenericArgument.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Mirror; | ||
|
||
namespace WeaverNetworkBehaviourTests.NetworkBehaviourClientRpcGenericArgument | ||
{ | ||
class NetworkBehaviourClientRpcGenericArgument<T> : NetworkBehaviour | ||
{ | ||
[ClientRpc] | ||
public void RpcCantHaveGeneric(T arg) { } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ts/Tests/Editor/Weaver/WeaverNetworkBehaviourTests~/NetworkBehaviourCmdGenericArgument.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Mirror; | ||
|
||
namespace WeaverNetworkBehaviourTests.NetworkBehaviourCmdGenericArgument | ||
{ | ||
class NetworkBehaviourCmdGenericArgument<T> : NetworkBehaviour | ||
{ | ||
[ServerRpc] | ||
public void CmdCantHaveGeneric(T arg) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Assets/Tests/Editor/Weaver/WeaverNetworkBehaviourTests~/NetworkBehaviourGenericInherit.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Mirror; | ||
|
||
namespace WeaverNetworkBehaviourTests.NetworkBehaviourGenericInherit | ||
{ | ||
class NetworkBehaviourGenericInherit<T> : NetworkBehaviour | ||
{ | ||
protected T generic; | ||
} | ||
|
||
class NetworkBehaviourGenericChild : NetworkBehaviourGenericInherit<NetworkBehaviourGenericChild> { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Assets/Tests/Editor/Weaver/WeaverSyncVarTests~/SyncVarsGenericField.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Mirror; | ||
|
||
namespace WeaverSyncVarTests.SyncVarGenericFields | ||
{ | ||
class SyncVarGenericFields<T> : NetworkBehaviour | ||
{ | ||
[SyncVar] | ||
T invalidVar; | ||
} | ||
} |