Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug (IN-8232) Disabling Roslyn analyzers makes all MonoBehaviours unusable in Unity 2022.2.0a17

Discussion in '2022.2 Beta' started by StellarVeil, Jun 26, 2022.

  1. StellarVeil

    StellarVeil

    Joined:
    Aug 31, 2018
    Posts:
    73
    The recompile speed up benefit after script change in 2022.2.0a17 works only if you disable Roslyn analyzers in Project settings > Player but doing so makes about any Monobehaviour script no longer usable even newly created ones.
    Displayed message on scripts: "No Monobehaviour scripts in the file, or their names don't match the file name."
    This message is erroneous cuz even if you start an empty proj > create a new C# file > disable Roslyn > reimport the file you will get that message again and you're unable to add it to a game object and if you already did before the issue happens then the component becomes disabled on inspector and doesn't execute on play.

    Renabling Roslyn analyzers makes the issue disappear but no longer have the recompile speed benefit introduced in 2022.2.0a.

    Case IN-8232.

    No answers so far on the report so please check it out cuz script change iteration time has been an ongoing issue for many ppl for many years (read Script Assemblies Reload threads) and I've been looking forward this kind of improvement for a long time and it's very important for productivity and end product quality due to hindered unit testing process.
     
    Last edited: Jun 26, 2022
    Ruslank100, oscarAbraham and Lahcene like this.
  2. ThisIsNotMyName123

    ThisIsNotMyName123

    Joined:
    May 10, 2022
    Posts:
    51
    What's the status of the report now? I mean there's not much point in Unity doing these optimisations if they can't be used, other than checking a checkbox on some sprint plan. It seems that awfully lot of the things Unity does is to appease a project manager in a way that doesn't benefit its customers whatsoever.
     
  3. StellarVeil

    StellarVeil

    Joined:
    Aug 31, 2018
    Posts:
    73
    I've been told a fix was made for a later (unmentioned/pending) version and that the option to enable/disable the analyzers would be removed in later versions anyway (probably in 2022.2f & beyond).
    Regardless the iteration improvement is just too insignificant & not very consistent to rely on.

    I've been using Hot Reload for Unity lately, it's a nice tool and free for Personal Unity users, it eliminates the need for recompilation and Asm Reload for a good chunk of the time and is very useful for iterating during runtime BUT there're still several cases where it doesn't work (mentioned on their site and the app's log) so you have to recompile manually and sometimes it causes bugs that can only be cleared by closing their app + recompiling manually.

    Basically Unity said the only efficient way they can/intend to fix this issue is by replacing Mono with CoreCLR in editor side expected in 2024 or later.