Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
1
Question by DaiMangouDev · Oct 03, 2015 at 12:41 AM · c#visual studiodll

How to link a class Library project in visual studio with my generated visual studio .sln unity project ?

Hi , by default my scripts open in Visual studio. great.

I am working on a managed dll in another visual studio project .

the codes in my solution project that unity generates uses the namespace which will also be use in my dll.

As things are I have to be working with two identical codes in both projects . In my unity project I work with the code which should be my dll code . I just want my unity project to read the code from my class library project.

I want to delete my script from unity, have my class library project link with my solution that unity generates so that the classes in my unity project that use the namespaces existing in the dll will have access to the namespaces .

How can I do this ?

Comment
Add comment
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

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by UsulPro · Oct 03, 2015 at 04:31 AM

Hi, @DMDev! I use Unity 5 and VS2015 so don't sure about previous versions. The short answer is just put your dll into assets folder and add reference to it in your unity project. After that you can add "using classlibrary" string and work with this namespace.

In more details:

1 check that your library project use 3.5 .net.

2 set the building path to your unity asset folder in project settings

3 open your unity project and add your library project to solution so it will be available each time you open a script in unity

4 after editing code in library project you need to rebuild this project to have access to changes from unity project.

Comment
Add comment · Show 5 · 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 UsulPro · Oct 03, 2015 at 04:35 AM 0
Share

if you want to have access to your Unity proj from library proj you can do the same. But first add solution, build it, then add "UnityProj\Temp\UnityVS_bin\Debug\Assembly-CSharp.dll" to your library project.

avatar image DaiMangouDev UsulPro · Oct 03, 2015 at 12:15 PM 0
Share

okay , I have set the build path to my the desired folder in my assets folder in Unity. Problem is that if i do a build release , the references and a bunch of other unnecessary files get exported into unity too . which is problematic.

How an I only have my dll be exported ?

avatar image UsulPro · Oct 03, 2015 at 03:09 PM 0
Share

Yes, you are right! In this case better to leave the build path as it was and add post build event (project properties -> build events):

copy $(TargetPath) YourUnityProject\Assets\Dll\$(TargetFileName)

(the destination folder should exist) It will make copy of your dll automatically each time after building. In this version you can easily use crossover references to share a namespace in both direction.

avatar image DaiMangouDev UsulPro · Oct 03, 2015 at 04:51 PM 0
Share

so i nee to copy the dll at "C:\$$anonymous$$yProjects\Visual Studio\$$anonymous$$ylibrary Library\$$anonymous$$ylibrary \$$anonymous$$ylibrary \bin\Release\$$anonymous$$ylibrary .dll"

to my folder in my unity project under "C:\$$anonymous$$yProjects\Unity\Projects\Valding\Valding\Assets\Classes\VadingClasses"

How do i plug that into copy $(TargetPath) YourUnityProject\Assets\Dll\$(TargetFileName) I tried but failed.

I will accept your answer :) thanks for all the help

avatar image UsulPro DaiMangouDev · Oct 03, 2015 at 05:44 PM 0
Share

copy $(TargetPath) C:\$$anonymous$$yProjects\Unity\Projects\Valding\Valding\Assets\Classes\VadingClasses\$(TargetFileName)

You are welcome! :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

29 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can not implicitly convert a unityEngine.GameObject from unityEngine.Coremodule.dll to unityEngine.GameObject from Unityengine.dll 1 Answer

Distribute terrain in zones 3 Answers

Why are Vector2 parameters of methods , set to be = new Vector2 , read as being null by dll ? 1 Answer

How to get referenced object from TransparentProxy? 0 Answers

Multiple Cars not working 1 Answer


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