• 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 epratt · 11 hours ago · script.visual studio

Visual Studio 2022 fails to open solution to selected script from Unity and keeps opening new windows

Using Unity 2020.3.28f1 and Visual Studio 2022 Professional. Made sure Visual Studio 2022 didn't have any updates.

Just so we're clear, there is no problem with Unity and Visual Studio 2022 Professional communicating. I can debug, use intellisense, etc. Everything works fine in that sense (Yes I know there are posts about this already, but bear with me). I have the typical problem where when I double click on a .cs file in Unity it opens visual studio solution file, but it doesn't open the file that was selected in Unity. It only opens the project to a blank page. And what's even better is if I already have the solution open when I select a file in Unity, it will open up the solution... again... in another window... Does the whole loading bar thing, making the connection between Unity and Visual Studio and everything.

This is the gist of what people say to do when things aren't behaving properly when opening a script in Unity.

I've been using 2019 Professional and just installed 2022 Professional. I've looked at tons of posts both on stackoverflow and here and have followed all steps for anything related to my problem and still haven't found a solution. I feel like this is a new case, thus the new question.

What I've done (in order):

  • I made sure I was on the most up-to-date Visual Studio Editor package in Unity (2.0.15 at the moment)

  • I updated preferences in Unity by going to Edit > Preferences > External Tools and selected Visual Studio Professional 2022 (17.2.3)

  • Ticked Embedded packages, Local packages, and Player projects

  • Code Optimization On Startup is set to Debug on the General tab

  • Uninstalled VS 2019

  • Restarted my computer

  • cleared all unity and visual studio files out of appdata, localappdata, and what was listed in the LocalLow folder in appdata for Unity

  • opened a .sln file from windows explorer and told windows to use VS 2022 to open files with that extension

  • Closed out of Visual Studio

  • Removed all csharp files from my unity project along with the .vs folder and .sln file

  • Deleted all files/folders in my Unity project except for Assets, Packages, and Project Settings

  • Opened Unity and let it do its thing

  • Went to preferences in Unity and clicked on "Regenerate project files"

Windows knows to open .sln files using Visual Studio 2022, Unity opens the .sln file when I double click on a .cs file, a link is made between Unity and Visual Studio so I can debug and do other things, and yet, it will never open the actual file that was selected. And it will always open a new window every time.

If I create a completely new project, add a script, and try to open it, I get the same thing.

I was able to duplicate it on the most recent LTS Release of unity today (2021.3.4f1). I can't upgrade to a newer version of Unity, anyway, because of some pipeline related reasons I'd rather not get into.

I work over a vpn on an extremely secure network so I don't know if that has something to do with the disconnect, but thought I'd throw that piece of information out there just in case.

I'm not sure if this would be a bug with Unity or Visual Studio or if its even a bug at all, though it makes sense to me that it would be a unity bug. If the only fix is to upgrade to the newest version of Unity then I'll just accept that I'm screwed and just go back to VS 2019 or just accept that I need to use the solution explorer in VS to open up scripts rather than navigate to them in Unity. I just really like some of the new features that 2022 brings, so that will be a bummer to go without those.

Any help is appreciated. 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

0 Replies

· Add your reply
  • Sort: 

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

227 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 avatar image avatar image

Related Questions

After 2019.1.3 upgrade scripts aren't working properly the snippets not showing intelisense parameter info 0 Answers

Unity wont let me change to Visual Studio Code 0 Answers

My visual studio code does'nt work 0 Answers

VS Code Not Opening scripts correctly... Disappeared from unity preferences 1 Answer

transform.localscale to specific size 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