Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Rider suddenly having trouble connecting to unity for debug and unit test sessions

Discussion in 'Code Editors & IDEs' started by AdamBebko, Mar 9, 2022.

  1. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    168
    I've recently been experiencing a problem where I have to constantly click back and forth between unity and rider when debugging or running unit tests. for example

    Click run all unit tests in rider.. It stalls on pending... I click back on unity, nothing happens, click back on rider, nothing happens, then click on unity, and a little popup appears briefly that I can't read, but looks like the code refreshing popup, then back to rider, and suddenly all the tests run.

    Another possibly related issue, tests in unity take milliseconds to complete, whereas rider (once it finally gets going) takes around 20-30 seconds. It seems to have trouble moving between the different assemblies or something.

    Rider's code coverage isn't working at all, and crashes unity every time. Everything seemed to be working perfectly a month or two ago but I've since updated unity and rider a couple times.

    Anyone know of any way to fix this issue which seems to be related to

    Rider 2021.3.3, Unity 2021.2.14f1
     
  2. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    73
  3. DanVioletSagmiller

    DanVioletSagmiller

    Joined:
    Aug 26, 2010
    Posts:
    204
    Not personally using rider, but I would suggest checking that you have the latest Rider-Unity package installed. If you are on the latest, perhaps try going down one version to see if you have a bug from the current version.
    upload_2022-3-18_10-50-14.png
     
  4. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    168

    I submitted a bug report to Rider with logs as the support person suggested, haven't heard back. #3889544

    Yes rider plugin is up to date
     
    Walter_Hulsebos likes this.
  5. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,236
    I have been experiencing this way more often (within the last few weeks/months, ever since DOTS 0.50 came out and I had to move my projects back to 2020.x, instead of 2021.x) than I ever have in the past. It is constant. I have Alt+R in Rider mapped to refreshing Unity to compile and now it only works maybe 1 out of every 4-5 times that I try. I have to tab back to Unity, refresh there, then only sometimes when I go back to Rider does it show a connection again back to Unity. Otherwise it just thinks its disconnected / Unity is closed. Yet, most other things work as expected, it's just super annoying.
     
  6. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    516
    I am using Rider 2023.x edition and have been having issues attaching the unity editor.

    The only solution that worked for me was to

    1. Make sure you have the latest Rider Editor package in package manager
    2. Close unity editor and rider editor
    3. Navigate to the unity project and remove the *.csproj files (found on the project root folder)
    4. Reopen unity and proceed as normal with debugging with rider

    I found deleting the *.csproj files caused unity to regenerate them and it works

    Please note that if you go to Preferences/External Tools and click regenerate files that it still does not work. For some reason it does not properly regenerate the csproj files.
     
  7. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    73
    @GXMark would you please report an issue with Help->Report a Bug and agree to attach logs? We are definitely interested to look into it. Thank you!
     
  8. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    516
    Done.
     
  9. indoflaven

    indoflaven

    Joined:
    Sep 27, 2017
    Posts:
    6
  10. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    73
    Could you please send me the link directly or share it here? I can't find it unfortunately.
     
  11. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    516
  12. orloKun

    orloKun

    Joined:
    Jan 9, 2016
    Posts:
    7
    To anyone still having the issue, this solution worked with Unity 2023.2.14 and Rider 2023.3.3

    Thanks @GXMark for the solution.