- Home /
Can Unity API's be called from assemblies?
I'd like to call Unity API's from an external DLL assembly I'll be making. Can this be done? For example, create a GameObject, add Components, etc.?
What would the syntax for getting that going look like? Any online samples or tutorials? (I'm more familiar with old school C++ DLL building, never done this with C#, so any help greatly appreciated).
Answer by Mike 3 · Mar 20, 2011 at 06:00 AM
Yeah, it's fairly simple
In monodevelop, you just right click references, click edit references, go to the last tab, then search for the UnityEngine.dll
In visual studio it'll almost be the same i'd bet (See http://msdn.microsoft.com/en-us/library/wkze6zky(VS.80).aspx )
Either way, it's not much like c++ linking, it's a hell of a lot simpler and generally "just works".
After you've done that, you'll have full unity intellisense too, yay!
Just to be clear: Do I create a new 'class library' or 'empty project' or what? Then just add the reference, and start coding same as if it were in Unity? Insert a 'using Unity.Engine' and so forth?
Then build, and copy resulting .dll file to? On Windows, $$anonymous$$ac, iOS, Android? I've heard tell of a 'plugins' folder, would that be the same one the Editor uses?
Anywhere but the Plugins folder. That folder is for native plugins only really, and you'll end up with duplicated copies added into builds. All you need to do is drop it anywhere (but Plugins) in your assets folder and it'll get added in for use with editor and all platforms
Your answer
Follow this Question
Related Questions
How to work with Steam API? 1 Answer
Unity TestTools and External DLL conflict? 1 Answer
Creating Scenes Programmatically From A Deployed Build in Unity 1 Answer
External dll: namespace recognized by mono, not by UT 2 Answers
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers