Пример #1
0
    static void BuildAndroid()
    {
        string outputPath = string.Format("{0}/android", buildPath);

        CreateDirectory(outputPath);

        string executeName = string.Format("{0}.apk", PlayerSettings.productName);
        string targetDir   = string.Format("{0}/{1}", outputPath, executeName);

        GameManager.GameConfigInfo gameConfig = GameManager.Instance.GameConfig;

        PlayerSettings.Android.bundleVersionCode = gameConfig.VersionCode;

        string keystorePath = string.Format("{0}/helper/android_keystore/{1}", buildPath, gameConfig.KeystoreName);

        PlayerSettings.Android.keystoreName = keystorePath;
        PlayerSettings.Android.keystorePass = gameConfig.KeyaliasPass;
        PlayerSettings.Android.keyaliasName = gameConfig.KeyaliasName;
        PlayerSettings.Android.keyaliasPass = gameConfig.KeyaliasPass;

        BuildOptions buildOptions = GetBuildOptions();
        bool         success      = ProcessBuild(scenes, targetDir, BuildTarget.Android, buildOptions);

        if (success)
        {
            // 단말기 연결시 설치 및 실행
        }
    }
Пример #2
0
    static void BuildiOS()
    {
        string outputPath = string.Format("{0}/ios", buildPath);

        CreateDirectory(outputPath);

        GameManager.GameConfigInfo gameConfig = GameManager.Instance.GameConfig;

        PlayerSettings.iOS.buildNumber = gameConfig.GetVersionCode();
        PlayerSettings.iOS.sdkVersion  = iOSSdkVersion.DeviceSDK;
        //PlayerSettings.iOS.targetOSVersion = iOSTargetOSVersion.iOS_8_0;
        PlayerSettings.iOS.targetOSVersionString = gameConfig.IOSTargetVersion;
        PlayerSettings.statusBarHidden           = true;

        BuildOptions buildOptions = GetBuildOptions();

        // 최초 빌드시에는 제거한다.(이 옵션의 의미는 Unity에서 프로젝트를 iOS버전으로 빌드할때 현재 이미 빌드된 프로젝트 파일들이 있을 경우 Replace하지 말고 Merge하라는 의미)
        // XCode 프로젝트를 생성하는 첫번째 빌드시에는 제외시켜야 한다.
        if (gameConfig.IOSUseBuildHistory && PlayerPrefs.GetInt("BuildHistory") == 1)
        {
            buildOptions |= BuildOptions.AcceptExternalModificationsToPlayer;
        }

        bool success = ProcessBuild(scenes, outputPath, BuildTarget.iOS, buildOptions);

        if (success)
        {
            // Nothing Xcode project
            PlayerPrefs.SetInt("BuildHistory", 1);
            PlayerPrefs.Save();
        }
    }
Пример #3
0
    static BuildScript()
    {
        GameManager.GameConfigInfo gameConfig = GameManager.Instance.GameConfig;

        PlayerSettings.productName = gameConfig.ProductName;
        //PlayerSettings.bundleIdentifier = gameConfig.BundleName;
        //PlayerSettings.applicationIdentifier = gameConfig.BundleName;
        PlayerSettings.bundleVersion = gameConfig.GetVersionName();

        projectPath = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/'));
        buildPath   = string.Format("{0}/{1}", projectPath, targetDir);

        scenes = FindEnabledEditorScenes();
    }