2
\$\begingroup\$

So I want to compile an extensions dll for a unity game because I feel I'll end up reusing these extensions in other games/projects too - and I want to learn about external dependencies with Unity. :)

Anyway. I've found some posts that say to reference .NET 2.0, however, when selecting a framework in project settings, I get a list of Unity frameworks that I think were added to VS by either UnityVS(VSUnity?) or Unity 5.

I'm unsure which to select for an external DLL. :/

Unity Frameworks in Visual Studio

edit: I also thought the current Unity (v5) supported Mono up to the equivalent of .NET 3.5?

A related question. Whichever framework I end up selecting, will I be able to reference "UnityEngine" in said project?

\$\endgroup\$
  • \$\begingroup\$ I'm pretty sure that, unless you have plugins with extensive amount of code, you would be much better off not compiling them yourself. Not just that it's a big bother to do so, but you will have to make sure you compile them for each platform and then use the correct ones for each build you make. \$\endgroup\$ – zoran404 Aug 5 '15 at 21:51
  • \$\begingroup\$ @zoran404 is correct, though it's not too big of a deal once you figure out your workflow. I'd advise writing your code natively in the Unity Editor for testing, then migrate the code to a plugin when you are ready to ship. That is not always possible though, depending on what your plugin does. For example, I made a Debug DLL to wrap the Logger functions which is possible to do with native code in the editor, but when errors occur, it will reference the lines of code in my modified debug class. The editor ignores those lines when in a DLL and an error occurs. \$\endgroup\$ – Fuzzy Logic Aug 5 '15 at 22:01
  • \$\begingroup\$ That does make sense. I'm picking up Unity right now, coming from a C# hobby-dev background, and just trying stuff right now. Right now, I wanted to experiment with a plugin / reusable code for unity. Also, to have some place for some extension methods: link \$\endgroup\$ – Genesis2001 Aug 5 '15 at 22:21
1
\$\begingroup\$

If your DLL is free-standing. IE. does not need to reference Unity, then you should be fine with either framework as long as it is supported on your target platforms. Otherwise you will need to use one of the Unity frameworks.

Unity does not support the NET 4.0+ frameworks though, so you are limited to 3.5 or lower.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.