- Home /
Using "ouside" functions inside Unity?
Hi
Is it possible to use functions usually used in "normal" C#, inside Unity? There are a lot of good functions outside of Unity that I would like to use in my projects. Outside Unity, C# is a little bit different, but can I still use those functions? Is it just to add "Using System;" and "namespace ProjectName" in the script to make it work? All answers are appreciated.
Answer by whydoidoit · Aug 24, 2012 at 01:35 PM
Yes normal C# works fine. If you import System there are a couple of conflicts with UnityEngine including Object and Random - but you just need to disambiguate them with a using directive or by typing the fully qualified name. You cannot put you MonoBehaviour derivatives in a namespace in version 3.x of Unity - starting with 4 that restriction will be lifted. Other classes can be in namespaces.
Answer by Arshia001 · Aug 24, 2012 at 02:36 PM
You can also add a compiled .Net dll to your project's assets folder, and Unity will automatically add it to the build settings for the scripts, allowing you to use whatever's defined in there. So if something's not there, you can add its dll to your project (such as the VB .Net libraries).
Your answer
Follow this Question
Related Questions
Structs in C# Question 3 Answers
Inventory system using an array... 3 Answers
Inspector vs Script: Component best practice? 1 Answer
Unity freezes on play 2 Answers
Player movement issue... 1 Answer