• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by adamt · Jan 27, 2015 at 02:21 AM · pluginmonodevelopprojectdllsolution

Import C# project into my Unity solution

I've got a C# project (a game-agnostic networking framework called Networking) that I'd like to use with my Unity solution, in MonoDevelop. I've got it working when it's a standalone solution/project (i.e., not integrated within Unity's solution), and I'd imagine I can also get it working as a compiled DLL by placing it in the Plugins folder of my Unity project. However, I want to edit the C# project alongside my Unity code, in the same editor, and I'm running into issues.

What I have sorta working is this: I let Unity generate its .sln file, then import my project's existing .csproj file. That lets me have the Assembly-CSharp project alongside my Networking project. It seems to work, until Unity sees any new file and regenerates its .sln file, clobbering mine, and removing any references to my Networking project.

I've also tried to import my Networking project's source under the Plugins folder, which puts my source under the Assembly-CSharp-firstpass project that Unity generates. This might work fine but for the need to have multiple, disparate 3rd party projects co-existing within the same project. It seems less than ideal -- if it even works, I haven't thoroughly tested this -- especially when it comes to DLL references said projects need all being shoved into the reference list of the Assembly-CSharp-firstpass project.

Is there a way I can get Unity/MonoDevelop to let me edit my framework alongside the Unity code that calls it, preserving the framework's independence from the other Unity C# projects (e.g., Assembly-CSharp)?

Comment
ILICH

People who like this

1 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by LessThanEpic · Jan 27, 2015 at 03:09 AM

I would make a new sln that contains the csproj files from Unity and the the csproj files from your framework. Then you can have a master solution where the code lives side by side. As for getting the framework code into Unity I'd generate a dll and drop that into a plugins directory as you mentioned. You could set the output/build directory in the framework project to be the plugins folder so unity automatically gets updated every time you build.

I can't remember if Unity will generate it's own csproj files for you, so you might want to grab Visual Studio Tools For Unity. If you don't use Visual Studio you can still use the csproj files that get generated (although Microsoft just released a community edition of VS and since VS beats the pants off of MonoDevelop I'd look into it).

Comment
ILICH
krigby

People who like this

2 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image adamt · Jan 27, 2015 at 11:52 PM 0
Share

Thanks for the response. After I posted my question, I ran into another project that does something similar to what you described, although I'm not sure it's pointing the output directory to the Plugins folder -- that sounds like a great addition towards making the process seamless. Thanks for the tip!

And although I'd love to develop using Visual Studio, we're a Mac-based shop, so I'd have to do it through Parallels or VMware. That was less than ideal when I tried it a few months ago, but that was also during the time when MS had purchased SyntaxTree, and I wasn't able to get UnityVS. Maybe now it'll be better. I'll try again.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Edit asset DLL? 1 Answer

how to reference an enum from outside a built DLL 1 Answer

DLL placement 1 Answer

Import UnityPackage creates issues with Mono Solution 1 Answer

How to pass string to a unity plugin? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges