Skip to content

Update .NET API Compatibility Level check for modern Unity versions #391

@khayashi4337

Description

@khayashi4337

ISSUE: Outdated .NET Framework Compatibility Check

Description:

The current project contains an outdated compatibility check for .NET Framework 4.6 in ArcadiaProjectInitialization.cs. This check is no longer relevant for modern Unity versions that offer .NET Framework and .NET Standard 2.1 as API Compatibility Level options. The warning message generated by this check also refers to a setting that no longer exists in current Unity versions.

Current Behavior:

The project currently checks for .NET Framework 4.6 compatibility using the following code:

if (PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone) != ApiCompatibilityLevel.NET_4_6)
{
    Debug.LogWarning("API Compatibility is not .NET 4.6. Please change your API Compatibility in Edit > Project Settings > Other Settings or you will likely have issues.");
}

This code produces a warning message when the API Compatibility Level is not set to .NET 4.6, even though modern Unity versions offer .NET Framework and .NET Standard 2.1 as alternatives.

Expected Behavior:

The compatibility check should be updated to:

  • Support current Unity's API Compatibility Level options: Recognize and validate .NET Framework and .NET Standard 2.1.
  • Provide accurate warning messages reflecting available settings: Update the warning message to be relevant to the available API Compatibility Level options in current Unity versions.
  • Consider .NET Standard 2.1 as a valid modern option: .NET Standard 2.1 should be considered a valid and recommended option for cross-platform development.

Technical Details:

  • Modern Unity versions offer .NET Framework and .NET Standard 2.1 as API Compatibility Level options.
  • .NET Standard 2.1 is the modern approach for cross-platform .NET development.
  • The version numbers represent different specifications:
    • .NET Framework 4.6: Windows-specific implementation version (considered legacy).
    • .NET Standard 2.1: Cross-platform specification version.

Impact:

This update is necessary to:

  • Prevent false warning messages: Eliminate unnecessary and misleading warnings in modern Unity projects.
  • Ensure proper compatibility checks: Implement accurate compatibility checks that reflect the available API Compatibility Level options in current Unity versions.
  • Support cross-platform development practices: Promote the use of .NET Standard 2.1 for cross-platform compatibility.

Additional Notes:

  • Consider that .NET Standard 2.1 is Unity's preferred modern approach for cross-platform compatibility.
  • The updated check should provide guidance to users on how to configure the API Compatibility Level in the Unity Editor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions