Search code examples
unit-testingunity-game-enginenunitrider

Rider can't resolve symbol for UnityTest although the tests run (OSX, M1)


I recently started having this issue where although my tests run properly, Rider forgets the reference to the [UnityTest] attribute. It shows up as an error in Rider, but not in Unity. Although the namespace is already imported, after I do a quick action to fix the reference the errors disappear but only until the next save.

Mac OS: Ventura 13.0.1
Rider version: 2022.2.4
Unity version: 2021.3.15f1

I've attached a gif to show what exactly is happening:

After saving rider loses the reference


Solution

  • I finally found the answer in this post. I'm not sure what exactly went wrong and got cached but the solution was to invalidate the cache by calling this action:

    File | Invalidate Caches | Invalidate and Restart

    Hope this will help others!