Description
I am trying to implement a NetworkBehaviour that can support a Generic Type class
public class TestClass <T>: NetworkBehaviour where T : Class{
[ServerRpc]
private void TestServerRpc(){ }
}
If more than one Script Inherit the TestClass and get added to the scene editor produces error:
ArgumentException: An item with the same key has already been added. Key: 587641340 System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <9aad1b3a47484d63ba2b3985692d80e9>:0)
System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) (at <9aad1b3a47484d63ba2b3985692d80e9>:0) RPGS.NetiWorkie.TestBase1[T]..cctor () <0x183011b96c0 + 0x000fa> in <7ac8531f8a7d45d7887c97f2478b1c58>:0
Rethrow as TypeInitializationException: The type initializer for 'RPGS.NetiWorkie.TestBase1' threw an exception. RPGS.NetiWorkie.Test_Object..ctor () <0x183012b07d0 + 0x00052> in <7ac8531f8a7d45d7887c97f2478b1c58>
Note that the error appears only when the tags ServerRPC and ClientRPC are placed
Class Examples
public class Test_Object : TestBase<AnObjectDataClass> { }
public class Test_Tile : TestBase<AnTileDataClass> { }
A clear and concise description of what the bug is.
Reproduce Steps
Try the example scripts from above
Actual Outcome
We get an editor scripts and Netcode does not work properly
Expected Outcome
Should not get any errors
Environment
- OS: Mac and PC
- Unity Version: [2021.3.11f1]
- Netcode Version: [e.g. 1.5.1]
Description
I am trying to implement a NetworkBehaviour that can support a Generic Type class
If more than one Script Inherit the TestClass and get added to the scene editor produces error:
ArgumentException: An item with the same key has already been added. Key: 587641340 System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <9aad1b3a47484d63ba2b3985692d80e9>:0)System.Collections.Generic.Dictionary
2[TKey,TValue].Add (TKey key, TValue value) (at <9aad1b3a47484d63ba2b3985692d80e9>:0) RPGS.NetiWorkie.TestBase1[T]..cctor () <0x183011b96c0 + 0x000fa> in <7ac8531f8a7d45d7887c97f2478b1c58>:0Rethrow as TypeInitializationException: The type initializer for 'RPGS.NetiWorkie.TestBase
1' threw an exception. RPGS.NetiWorkie.Test_Object..ctor () <0x183012b07d0 + 0x00052> in <7ac8531f8a7d45d7887c97f2478b1c58>Note that the error appears only when the tags ServerRPC and ClientRPC are placed
Class Examples
A clear and concise description of what the bug is.
Reproduce Steps
Try the example scripts from above
Actual Outcome
We get an editor scripts and Netcode does not work properly
Expected Outcome
Should not get any errors
Environment