Before updating to Windows 10 you may need to return your Pro license. More information here

'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.


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: alt text

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! :)

more ▼

asked Nov 26, 2012 at 07:34 PM

avatar image

971 39 35 38

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Is the built assembly(dll) in the plugin folder in the inspector?

more ▼

answered Nov 26, 2012 at 07:48 PM

avatar image

13.3k 3 12 53

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 MonoDevelop?

Nov 26, 2012 at 07:51 PM PastryGood

First you may want to check out the documentation(http://docs.unity3d.com/Documentation/Manual/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.

Nov 26, 2012 at 08:44 PM Landern
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Nov 26, 2012 at 07:34 PM

Seen: 8635 times

Last Updated: Nov 26, 2012 at 08:44 PM