Same here, I use version 5.6.1f1, with the CSharp60Support package.
Everythings else work like a charm except this.
Any help would be appreciated.
Thanks.
We currently parse the source files to determine the name of the MonoBehavour contained within it. The parser does not understand some new C# features currently.
This will be supported at some point in the future when we fully support .NET 4.6 and C# 6.
This is also the case with the current experimental .net 4.6 on Unity 2017.1.0
Adding any using static directive before a MonoBehavior definition will cause Unity to no longer see the class as a MonoBehavior.
@JoshPeterson I donāt know if I find the time for this to isolate, but I think what @dungeonkim wrote is already enough in an empty project with experimental 4.6 enabled:
using static System.Math;
namespace Test
{
public class A : MonoBehaviour {
:
}
}
I confirm the issue on Unity 2018.2.3f1 with (or without) the latest Incremental Compiler.
The problem seems to be with using static imports in types that are in a namespace.
Types without namespace mostly work.
I say mostly because you can still break the parser, but I found no consistent way of doing that.
This happens randomly with regular scripts for me aswell (no static using). But i also cannot reproduce it consistently (but when it happens, the āNamespaceā field in the debug-view inspector is empty).
Yeah, I saw more people reporting the same issue with 2018.2.3 here on the forums.
One guy reported that adding a space before the colon when inheriting from MonoBehaviour-derived classes fixed the issue for him (!)
Like, SomeBehaviour : MonoBehaviour works, but SomeBehaviour: MonoBehaviour breaks the parser.
I didnāt test it because Iām not using .2.3 anymore.