Create a new C # script in the newly created project. Then inspector says "No MonoBehaviour".
At that time, an error mark appears in the ConsoleWindow, and the game cannot be executed on the editor. However, the error details are not written in the main ConsoleWindow.

I think the problem is probably that MonoBehavior is not recognized, and I confirmed it on VisualStudio, but MonoBehavior was properly inherited, and the inherited class MonoBehavior was blue.
Once the project was destroyed and a completely new project was created, the same phenomenon occurred.
I restarted (shut down) UnityEditor, UnityHub, VisualStudio, and my computer and nothing changed.


Unity 2.14f

  • Answer # 1

    I'll try to find out what I found after examining various things

    From the conclusion, according to the link provided by Y0241-N
    C: \ Program Files \ Unity \ Hub \ Editor \% version (such as 2019.2.14f)% \ Editor \ Data \ Tools \ RoslynScripts
    The contents of the unity_csc file in

    set APPLICATION_CONTENTS =% ~ dp0 .. \ ..
    "% APPLICATION_CONTENTS% \ Tools \ Roslyn \ csc.exe"/shared% *
    exit/b% ERRORLEVEL%

    Please correct it to

    (part of csc.exe)

    If the location of the file is in a place that is protected by security, Windows 10
    Just follow this link to grant access

    The cause was written in the forum, but it seems that it is not usable for some reason even though it can be used without the .exe extension. So it seems that it can be used by specifying csc.exe properly instead of abbreviated as csc.

    From here on, my memorandum is my guess,
    set APPLICATION_CONTENTS =% ~ dp0 .. \ ..
    "% APPLICATION_CONTENTS% \ Tools \ Roslyn \ csc.exe"/shared% *
    Is this a language called cmd script? It seems to be written in, and it is close to computer language. Meaning
    "Currently running C: \ Program Files \ Unity \ Hub \ Editor \% version (2019.2.14f etc.)% \ Editor \ Data as a variable (APPLICATION_CONTENS) and further under \ Tools \ Roslyn \ csc. All files (* wildcard) share exe ".
    There was actually a csc.exe file in the specified directory.
    And there was a Mono folder in the directory specified in the variable APPLICATION_CONTENTS.
    This is probably the folder that UnityHub needs to use MonoBehaviour.
    The error NoMonoBehaviour came out this time, so I thought this might be the cause.

    Since the end is just a guess, there is a possibility of bullshit. Please understand