Unity iOSで対応言語を設定する

using UnityEngine;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
#if UNITY_IOS
using System.IO;
using Extension;
using UnityEditor.iOS.Xcode;
#endif

public class IosPostprocessBuild : IPostprocessBuildWithReport
{
    public int callbackOrder => 100; // プロジェクトに合わせて調整

    // https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundlelocalizations
    public static readonly string[] SupportLanguages =
    {
        "en",
        "ja",
    };

    public void OnPostprocessBuild(BuildReport report)
    {
        if (report.summary.platform != BuildTarget.iOS) return;

        Debug.Log("IosPostprocessBuild Start");

#if UNITY_IOS
        var plistPath = Path.Combine(report.summary.outputPath, "Info.plist");
        PlistDocument plist = new PlistDocument();
        plist.ReadFromFile(plistPath);
        SetLanguages(plist.root);
        plist.WriteToFile(plistPath);
#else
        Debug.LogError("IosPostprocessBuild UNITY_IOS is not defined");
#endif

        Debug.Log("IosPostprocessBuild Finish");
    }

#if UNITY_IOS
    private void SetLanguages(PlistElementDict root)
    {
        var array = root.CreateArray("CFBundleLocalizations");
        foreach (var localization in SupportLanguages) array.AddString(localization);
    }
#endif
}