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:
Now the problem is that when I then reference this namespace from within the lol.cs script like this:
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 MonoDevelop?
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.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
12 People are following this question.
SetActive() Object reference not set to an instance of an object.
Distribute terrain in zones
Changing values of a script from another script not showing in game
Using C# .dll that doesn't use namespaces
Using DLLS in a Webplayer