Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
  • Help Room /
avatar image
0
Question by DrewDunne · Oct 18, 2020 at 08:31 PM · optimizationservervisual studiosolution

How do I add scripts from a separate Unity project into my VS solution?

I am working on a Multiplayer game. This game utilizes two separate Unity Projects (GameClient and GameServer) in order to function. As you would expect, each of these projects contains unique scripts.

However, because there are two separate projects, Unity has generated two separate solution files:

  • GameClient.sln

  • GameServer.sln

This means that I must run two separate instances of Visual Studio to work on my project (one containing the GameClient scripts, and the other containing the GameServer scripts.

To streamline my workflow, and reduce the possibility of errors (via mistaking which .sln was selected), I'd like to merge both .csproj files into one VS Solution and have Unity open this "master .sln" file when I open a script within Unity.

Is there a way to override which .sln file Unity opens when opening a script?

If not, is there a way to include the .csproj files from the other projects into each solution (this way, I'd have two solutions but each would have visibility into all the files).

Hopefully I'm explaining my dilemma well. Thanks!

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
0
Best Answer

Answer by DrewDunne · Oct 18, 2020 at 09:02 PM

In case anyone searches for this in the future, I found a solution:


Open both .sln files in an editor (I used VSCode). Find where the environment iterates through Project persistence blocks, and copy relevant persistence block from each .sln file and paste each into the other .sln file. In my case, this meant copying:

 Project("{FAE14EC0-301F-11D3-BF4B-00C04F79AFBC}") = "Assembly-C-Sharp", "Assembly-CSharp.csproj", "{74BD5278-4F4A-94F6-630E-8B98EDA9781F}"
 EndProject

from my GameServer.sln file and pasting into the same location in my GameClient.sln file. I then did the same for the Client .sln into the Server .sln file.


Once that's done, we need to add a relative path to our project location, otherwise the .sln cannot locate it. Since my Unity Projects shared the same parent directory (the highest folder in my Git repository), this was a simple adjustment for both files:

ex from GameClient.sln:

 Project("{FAE14EC0-301F-11D3-BF4B-00C04F79AFBC}") = "Assembly-C-Sharp", "../GameServer/Assembly-CSharp.csproj", "{74BD5278-4F4A-94F6-630E-8B98EDA9781F}"
 EndProject


Note the addition of ../GameServer. The ../ navigates to the parent directory of the .sln file, and then I navigate down into my other Unity Project (/GameServer).


Last, I renamed each file so that it would be easier to recognize which project was which in my Solution Explorer:

 Project("{FAE14EC0-301F-11D3-BF4B-00C04F79AFBC}") = "Server", "../GameServer/SERVER.csproj", "{74BD5278-4F4A-94F6-630E-8B98EDA9781F}"
 EndProject

And now it works! I can see Scripts from both unity projects, as well as my library of shared scripts (cam.corelibrary) all in one instance of Visual Studio saving me a lot of alt-tabbing and potential mistakes.

alt text

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

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

225 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 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 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 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 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 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 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 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

Yield to see if NetworkServer sends back anything? 0 Answers

Unity/Visual Studio not generating a .sln file 1 Answer

Refactoring code for S.O.L.I.D principles 0 Answers

Missing MasterServer.exe 0 Answers

Why after importing Standard Assets my Visual Studio Solution has 3 projects ? 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