using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;

class CheckApi : IPreprocessBuildWithReport
{
    public int callbackOrder { get { return 0; } }
    public void OnPreprocessBuild(BuildReport report)
    {
        var group = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
        var api = PlayerSettings.GetApiCompatibilityLevel(group);
        if (api != ApiCompatibilityLevel.NET_4_6)
        {
            Debug.LogError("The required ApiCompatibilityLevel to compile MongoDB is NET4.x. Currently that has not been set. Please change the PlayerSettings. This application may not function correctly.");
        }
    }
}
