Hey there.
To analyze C# files, you must use the SonarScanner for .NET.
The problem, as I understand it, is that Unity projects aren’t typically built in the same fashion as most C# projects (using dotnet build or MSBuild.exe)
One workaround might be creating a “dummy” project that can be built using common .NET build tools which contains all your C# files that you use just to execute the analysis. Tools like this could be helpful in achieving this: GitHub - microsoft/MSBuildForUnity: MSBuild integration in Unity
You could also try following up on this thread where another user was trying the same:
Sorry if it’s not too helpful – our ecosystem just doesn’t well support analysis of Unity projects at this time.