Im trying to create a dll for the Editor and even though the library im making is targetting .Net 2.0 and has included references to both UnityEngine.dll and UnityEditor.dll from the managed folder I get this error and doesn’t compile:
“Error 8 The type or namespace name ‘UnityEditor’ could not be found (are you missing a using directive or an assembly reference?)”
I think it goes away if I target 4.5 .Net but then I get reflection issues in the editor
Yes, you are right. But the error message sounds a little weird. I can’t remember that I ever had such an error message. I am not using MonoDevelop to create dlls, but a custom solution, but even like that, it is technically the same.
Are you really sure that the UnityEditor.dll is referenced correctly?
Did you try to create a web player build of your project? If there is an issue with one of the scripts, you may only find it when you create an actual build as otherwise the editor won’t show any error messages.
It’s an Editor dll that I am making to extend the UnityEditor, so I dont need to build or switch platforms, I am in the basic PC/Mac/Linux setting but I dont get there as the project doesnt compile to create the dll because it says it cant find the unityEngine.dll in 2.0 but it does in 4.5, which is weird
It is only possible to find issues editor and non editor scripts by creating a build. You may create a build for any platform, just to test whether there is an issue or not. I am proposing weird ideas, because the error message sounds like that as well.
But anyway, it seems that alexzzzz has more experience with creating dlls within an IDE.
I don’t know, what “.Net 2.0” and “.Net 2.0 Subset” actually mean in Unity, but I do know that Microsoft .Net Framework 2.0, 3.0 and 3.5 - all three of them use the same version of runtime - CLR 2.0. Therefore there’s no really much difference between targeting 2.0 or 3.5.
Finally to call the method i want, do I need to use proxies? or just external because when i do extern I get that it doesnt find the method I m calling for
Yes, you are right. Managed dlls can be accessed like any regular script without the need to use proxies. This is only needed for native plugins (C/C++/Objective C, …).