The apiCompatibilityLevelPerPlatform is never returned when using CLI
- NuGetForUnity Version: Master branch
- Unity Version: 2020.3.48f1
- Operating System: Windows
To me it looks like the Method ReadApiCompatibilityLevel(string projectPath) will returns as soon as it found the textline "apiCompatibilityLevel:" and was able to parse the integer value.
if (trimmedLine.StartsWith(apiCompatibilityLevelConfigName, StringComparison.OrdinalIgnoreCase))
{
var stringValue = trimmedLine[apiCompatibilityLevelConfigName.Length..].Trim();
if (int.TryParse(stringValue, out var value))
{
return value;
}
}
However, it finds and parse the "apiCompatibilityLevelPerPlatform:" entries as well, but at least my Unity always includes the general "apiCompatibilityLevel:" at the end of the ProjectSettings.asset file.
I would suggest not to return immediately, but instead keep the value and only use it in case no "PerPlatform" value has been found.
It would also be good if we could specify the platform.
What seems also strange is the decision which .NET version should be used:
return perPlatformConfig.Values.Max();
.NET2.x has the integer value 6 and and .NET4.x has a integer of 3. So Max() would return .NET2.x