Search Unity

Could not get my DLL to compile after updated to Unity 2020 or above

Discussion in 'Editor & General Support' started by Nickromancer, Nov 12, 2021.

  1. Nickromancer

    Nickromancer

    Joined:
    Jul 31, 2016
    Posts:
    92
    I have an editor tool project which build fine when using DLL files from Unity 2018, 2019.
    However, after upgrading to use Unity 2020 or 2021, the build fails.

    Source code is not changed and I just updated the reference path of the two UnityEngine.dll and UnityEditor.dll from the Unity installed folder to point to 2020 version. Didn't expect it to fail. If I point it back to 2019 folder, it will compile again. Anyone know how to do it using 2020 or newer?

    Below is the errors.

    error CS0246: The type or namespace name 'EditorWindow' could not be found (are you missing a using directive or an assembly reference?)
    error CS0246: The type or namespace name 'MenuItem' could not be found (are you missing a using directive or an assembly reference?)
     
  2. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,066
    Which DLLs are you referencing? Note that there's more than one e.g.
    UnityEditor.dll
    , there's one in
    Managed/UnityEditor.dll
    and another one in
    Managed/UnityEngine/UnityEditor.dll
    .

    I believe the first one is the legacy DLL that contains all types in the
    UnityEditor
    namespace. The second one is the more modern modularized one, where many of the types have been moved to separate
    Managed/UnityEngine/UnityEditor.*Module.dll
    assemblies.

    MenuItem
    and
    EditorWindow
    specifically have been moved to
    UnityEditor.CoreModule.dll
    .
     
  3. Nickromancer

    Nickromancer

    Joined:
    Jul 31, 2016
    Posts:
    92
    I am using the one under Managed folder. I didn't try the one under the Managed/UnityEngine. I will try to use the modern modularized later. Thanks
     
  4. Nickromancer

    Nickromancer

    Joined:
    Jul 31, 2016
    Posts:
    92
    Wow. It works. I added every DLL as reference because there seems to be missing a lot things when I switch to the modularized version but its totally fine. The output DLL is just as small as before. Thank you.