Search Unity

Feedback Broken (just kidding) scripts after update from 2020.3.10 -> 2020.3.11.

Discussion in 'Editor & General Support' started by JasonC_, Jun 10, 2021.

  1. JasonC_

    JasonC_

    Joined:
    Oct 27, 2019
    Posts:
    66
    After updating from 2020.3.10 to 2020.3.11, a number of component scripts in my project said "failed to load" in the inspector, but there were no compilation or console errors.

    Upon deleting the non-loaded components and attempting to re-add the components, a message box pops up and says "This script is an editor script". I'm having trouble making sense of this because those scripts aren't editor scripts, and have been working fine at least back to 2020.3.6.

    What's going on?
     
  2. JasonC_

    JasonC_

    Joined:
    Oct 27, 2019
    Posts:
    66
    Wait; I just figured it out. The update was a red herring. Essentially it was related to the facts that:
    • changing assembly definition platform settings doesn't automatically lead to reimport if the setting for the current platform doesn't change
    • Unity specifically treats assemblies set to "any platform = false" + "include = editor" as editor assemblies, and treats "any platform = true" + "exclude = everything except editor" as non-editor assemblies
    • I had changed an assembly containing experimental code from the latter to the former about a week ago but never noticed an issue, because I never did anything to trigger a reimport of those scripts that whole time.
    • The .10 to .11 update forced a reimport and only then did the issue manifest itself.
    So I'm going to change this to a feedback post, and suggest the following:
    • If the platform selection for an assembly definition changes, the scripts in that assembly should be reimported and the assembly recompiled even if the effective setting for the current platform didn't change. This should be done so any issues with editor script detection become immediately apparent.
    • When component scripts are missing after a reimport, a warning should be logged to the console. In most cases some other condition happens first (e.g. a compilation error) that generates console messages. But, in the case of assembly platform changes leading to "editor script" status changes, there are no warnings, and components just become silently missing -- the only way to notice is to either hunt through all your game objects or observe incorrect behavior in your application.
    Windows 10, 64-bit, MSVC 2019 16.10.0