- Home /
'The type or namespace name could not be found'
Hey all,
I have a bit of a problem which I've just starred myself blind at.
First of all, don't make too much of the silly names in my current scripts and DLLs :P It is simply a quick demo to explain what is wrong.
Anyways,
I've compiled my own DLL from MonoDevelop with one simple class in it. The class is called MyClass I've placed the class in a namespace called mao. In the MonoDevelop assembly browser, you can see the structure clearly:
Now the problem is that when I then reference this namespace from within the lol.cs script like this:
using mao;
using mao; I can easily compile the code from within MonoDevelop and no error is raised at all.
But when I hit the play test button from the unity editor I am presented with the following error:
Assets/Scripts/lol.cs(3,7): error CS0246: The type or namespace name `mao' could not be found. Are you missing a using directive or an assembly reference?
And I have no clue as to why this is happening.
Any help or tip would be appriciated :)
Thank you for your time! :)
Answer by Landern · Nov 26, 2012 at 07:48 PM
Is the built assembly(dll) in the plugin folder in the inspector?
Aha! This did the trick, thank you so much for the help :) Could you describe exactly why it is that unity require the DLL to be included through the inspector? Is it simply the way that Unity compiles and links projects that requires it to be referenced through Unity rather than strictly through $$anonymous$$onoDevelop?
First you may want to check out the documentation(http://docs.unity3d.com/Documentation/$$anonymous$$anual/UsingDLL.html).
From what I gather this is just how its done, i don't think it does a typical visual studio linkage from monodevelop. But that's just a guess. Putting it into the project allows unity to be aware of the assembly. solution files and project files from mono or VS are for the convenience of the user using said IDE's for development. Deleting them doesn't hurt unity's ability to build the project from my experience.