Closed ooonush closed 5 months ago
Is this problem caused by the fact return new T();
is used instead of Activator
?
Unity code stripping removes unused code. In particular, the AdaptiveLocalTransformTickSmoother class is created only using ObjectCaches.Retrieve(), which uses Activator.CreateInstance() reflection. I suggest replacing reflection with a new() constraint on T. This solved the problem for me.
I've added a default ctor for the class and put a [Preserve] attribute over it. Originally we went with new() but there were limitations with it, I unfortunately do not recall which.
If adding the new() conditional doesn't throw anything at compile time though, it's safe to say whatever that limitation was it isn't affecting FishNet at the moment. I do not have time to get this into the 4.3.4 release but I will the next.
Added in manually but cannot merge due to conflicts. Please feel free to make another PR for attribution if you like.
Added new () constraint for T in ObjectCaches class
677