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?)
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.
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.