This simple code compiles in mono (and rightly so) but not in unity4 (has not tested in unity3 but assume it’s broken there too)
public class TestBase
{
public virtual void Bar<U>(U t) where U : TestBase
{}
}
public class Test<T> : TestBase
{
void Foo(T t){}
void Foo(object o){}
public override void Bar<U>(U t)
{
Foo (t);
}
}
As you can see it should compile. If type of U is not T then it should call Foo(object).
This really is quite a fundamental language principle isn’t it?
Mono runs it just fine, Unity not so much so:
It’s like unity cant see the Foo(object)-function for some reason.
This really is a showstopper in a project I’m currently working on…
That’s the background. I guess my questions are:
#1 Is this a known limitation of some sorts = wont be ‘fixed’ anytime soon, or is this a bug?
#2 If it’s a bug, will it be fixed anytime soon or will I have to redesign all my code? ![]()
#3 Either way, does anyone know a good way to deal with it / work around it without too much hassle?
Ps. Dont use the forums often, should I post it someplace else?