FishNet
FishNet copied to clipboard
Using generics with NetworkBehaviour classes throws at runtime.
Reported by Khalos.
Using generics with NetworkBehaviour classes throws at runtime. Reproduced by adding the following to an object in the scene.
using FishNet.Object;
public class Base<T> : NetworkBehaviour
{
}
public class GenericIssue : Base<string>
{
}
Decompiler shows the generics are not being included when Awake is initializing. Codegen will need to be adjusted to check for generics in Awake calls, and NetworkInitialize calls.
//invalid generated code.
if (((AA<>) this).NetworkInitializeEarly_AA`1_Assembly\u002DCSharp\u002Edll)
return;
Just ran into this as well. Did anyone ever find a workaround?
This is currently being worked on. There is no ETA yet but with current progress everything is believed to be working except SyncVars in the generic types.
Added support for this in 2.6.0. Currently available for public testing.
No reports of problems yet. We may have some rare instances down the road but until then this is considered working!