using UnityEngine;
using UnityEditor;

public class BuildCompressedPlayer : MonoBehaviour {

    [MenuItem("Build/BuildAndroid")]
    static void BuildAndroid(){
        Build(string.Format("{0}_{1}_{2}.apk", PlayerSettings.productName, PlayerSettings.bundleVersion, PlayerSettings.Android.bundleVersionCode), BuildTarget.Android);
    }

    [MenuItem("Build/BuildIOS")]
    static void BuildIOS(){
        Build("xcode", BuildTarget.iOS);
    }

    static void Build(string locationPathName, BuildTarget buildTarget){
        BuildOptions opt = BuildOptions.SymlinkLibraries;
//        opt |= BuildOptions.Development;
        opt |= BuildOptions.CompressWithLz4;
        BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, locationPathName, buildTarget, opt);
    }
}
