Quick answer: Unity asmdef-protected internals not visible in your test assembly? Add [assembly: InternalsVisibleTo("OtherAssembly")] in an AssemblyInfo.cs.
A test assembly can’t access internal classes from the runtime assembly even though both are in the project. asmdef boundaries enforce C# internal visibility — needs explicit permission.
AssemblyInfo.cs Pattern
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("MyGame.Tests")]Place this in any .cs file in the source assembly. The target assembly name must match the asmdef’s Name, not the folder.
Asmdef Name vs Filename
The asmdef’s name field is what the compiler emits. If your asmdef file is MyGame.Tests.asmdef but its name is Tests, the InternalsVisibleTo target is Tests.
Test Asmdef References
The test asmdef must also reference the runtime asmdef. InternalsVisibleTo grants visibility; the reference enables linking. Both are required.
Verifying
Test code calls runtime internals and compiles. Removing InternalsVisibleTo produces the expected CS0122 error.
“Asmdef boundaries enforce internals. Grant access with InternalsVisibleTo using the assembly Name.”
For test assemblies, generate the AssemblyInfo.cs as part of project setup — new devs hit this exact wall on day one otherwise.