1
\$\begingroup\$

Bit of a noob question, but I'm having trouble getting unit testing working in Unity. I created a PlayMode test assembly, I toggled "Enable playmode tests for all assemblies" as directed in the manual, but when I try to edit the test script, Visual Studio still isn't recognizing references to the classes I've written. There's also no option to manually add a reference within Visual Studio. Am I doing something wrong, or is this some kind of bug? It's hard to imagine what kind of unit testing you could even do without references to your main project.

\$\endgroup\$
1
\$\begingroup\$

Figured out how to do it. I had to create a new assembly definition in my Scripts folder. (I also moved my Tests folder out of the Scripts folder to be on the safe side.) Then, looking at the Tests assembly definition in the Inspector, I added a new item to the Assembly Definition References list, which I made point to my MainAssembly.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.