grofit / bindingsrx

A 2 way binding system for unity using unirx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mono Compiler issue with Generics in unity 5.4 (or less)

grofit opened this issue · comments

commented

Unity 5.4 has an issue within the mono compiler where it does not correctly find the right generic signatures within unirx.

Explicit unity 5.4 build download

There is specifically a build [here] (https://github.com/grofit/bindingsrx/releases/0.3.1) that explicitly sets the generics required, however in unity 5.5 and above this issue has been fixed.

Fixing it yourself (VS + R# or Rider)

If you wish to fix this issue yourself it is SUPER easy if you have resharper, as all you need to do is go to the problematic lines (unity will tell you where they are, generally all Select statements) and just press alt + enter to infer generic usage, this will solve the problem for you.

Fixing it yourself (Non R#)

If you do not use resharper or rider then all you need to do is go through GenericBindings.cs and there will be a few .Select(Converter.From) calls, and you just need to change these to .Select<T1,T2>(Converter.From) (or depending on if its To/From in the call it may be T2 first then T1), there are a few other issues unity will point out, but in most cases you can manually infer the generic and the problem will go away.


As mentioned the above build contains this fix, but new versions will only support unity 5.5 out the box, this is because the additional code changes are superfluous when the unity bug is fixed, also it is painful trying to keep 2 versions of unity installed and run with, so given the fixes are quite easy and there is a build to use to assist this should help those with u5.4 issues. Although if anyone wants to maintain it feel free to make a branch which is kept in-line with master but is for 5.4 releases or whatever.