ActivateProfile() private method

private ActivateProfile ( ) : void
return void
Exemplo n.º 1
0
        private static bool ProcessBuild(string channelName, BuildTarget target, string targetFolder = "", bool debugMode = false, bool il2cpp = false, bool developmentBuild = false, bool isIosHook = false)
        {
            // reimport all shaders
            string shaderFolderPath = "Assets/Standard Assets/Shaders";

            AssetDatabase.ImportAsset(shaderFolderPath, ImportAssetOptions.ImportRecursive | ImportAssetOptions.DontDownloadFromCacheServer);

            TextAsset     mChannelTextAsset = AssetDatabase.LoadAssetAtPath <TextAsset>("Assets/OriginalResRepos/DataPersistent/BuildChannel/ChannelConfig.json");
            ConfigChannel channelConfig     = ConfigUtil.LoadJSONStrConfig <ConfigChannel>(mChannelTextAsset.text);

            // ! 用设置里的配置

            /*
             * if(target==BuildTarget.iOS)
             * {
             *      PlayerSettings.SetPropertyInt("ScriptingBackend", (int)ScriptingImplementation.IL2CPP, BuildTarget.iOS);
             *      //PlayerSettings.SetPropertyInt("Architecture", (int)iPhoneArchitecture.Universal, BuildTargetGroup.iOS);
             *      PlayerSettings.SetGraphicsAPIs(BuildTarget.iOS, new UnityEngine.Rendering.GraphicsDeviceType[] { UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2 });
             * }
             */

            PlayerSettings.productName      = channelConfig.ProductName;
            PlayerSettings.bundleIdentifier = channelConfig.BundleIdentifier;
            PlayerSettings.bundleVersion    = GlobalVars.VERSION;

            /* 安卓要设置version code */
            if (target == BuildTarget.Android)
            {
                PlayerSettings.Android.bundleVersionCode    = Mathf.Max(channelConfig.VersionCode, GlobalVars.BUNDLE_VERSION_CODE);
                PlayerSettings.Android.useAPKExpansionFiles = channelConfig.Obb;
            }

            string DefineSymbols = channelConfig.PreDefines;

            if (debugMode)
            {
                DefineSymbols += ";NG_HSOD_PROFILE";                 // ! 打包机出来的设备上 Debug 模式总是用 PROFILE 设置
            }
            if (target == BuildTarget.iOS && isIosHook)
            {
                DefineSymbols += ";NG_HSOD_IOS_HOOK_RES";                 // ios 分包
            }
            // for behavior manager
            DefineSymbols += ";DLL_RELEASE";
            // avpro
            if (!debugMode)
            {
                AkPluginActivator.ActivateRelease();
                DefineSymbols += ";AVPROVIDEO_DISABLE_DEBUG_GUI;AVPROVIDEO_DISABLE_LOGGING";
            }
            else
            {
                // activate wwise profile
                AkPluginActivator.ActivateProfile();
            }

            BuildOptions mBuildOptions = BuildOptions.SymlinkLibraries;

            if (developmentBuild)
            {
                mBuildOptions |= BuildOptions.Development;
                mBuildOptions |= BuildOptions.ConnectWithProfiler;
                mBuildOptions |= BuildOptions.AllowDebugging;
            }

            // 如果不是安卓只用il2cpp,如果是安卓用参数开关il2cpp
            if (target != BuildTarget.Android || il2cpp)
            {
                PlayerSettings.SetPropertyInt("ScriptingBackend", (int)ScriptingImplementation.IL2CPP, target);
                PlayerSettings.strippingLevel = StrippingLevel.Disabled;
            }
            else
            {
                PlayerSettings.SetPropertyInt("ScriptingBackend", (int)ScriptingImplementation.Mono2x, target);
                PlayerSettings.strippingLevel = StrippingLevel.Disabled;
            }

            var targetGroup = target == BuildTarget.Android ? BuildTargetGroup.Android : BuildTargetGroup.iOS;

            PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, DefineSymbols);

            var scenes    = GetBuildScenes(DefineSymbols);
            var buildPath = targetFolder;

            if (scenes == null || scenes.Length == 0 || buildPath == null)
            {
                return(false);
            }

            Debug.Log("Start building player for " + target.ToString());
            Debug.Log("ChannelName= " + channelName);
            Debug.Log("DefineSymbols= " + DefineSymbols);
            Debug.Log("developmentBuild= " + developmentBuild);

            AssetDatabase.Refresh();

            BuildPipeline.BuildPlayer(scenes, buildPath, target, mBuildOptions);

            Debug.Log("Build player finished!");

            return(true);
        }
Exemplo n.º 2
0
    // Perform all necessary steps to use the Wwise Unity integration.
    bool Setup()
    {
        bool NoErrorHappened = true;

        // 0. Make sure the soundbank directory exists
        string sbPath = AkUtilities.GetFullPath(Application.streamingAssetsPath, Settings.SoundbankPath);

        if (!Directory.Exists(sbPath))
        {
            Directory.CreateDirectory(sbPath);
        }

        // 1. Disable built-in audio
        if (!DisableBuiltInAudio())
        {
            EditorUtility.DisplayDialog("Warning", "Could not disable built-in audio. Please disable built-in audio by going to Project->Project Settings->Audio, and check \"Disable Audio\".", "Ok");
        }

        // 2. Create a "WwiseGlobal" game object and set the AkSoundEngineInitializer and terminator scripts
        // 3. Set the SoundBank path property on AkSoundEngineInitializer
        if (!Settings.OldProject)
        {
            CreateWwiseGlobalObject();
        }

        // 4. Set the script order of AkInitializer, AkTerminator, AkGameObj, AkBankLoad (before default time), AkAudioListener by changing the .meta file
        if (!SetAllScriptExecutionOrder())
        {
            EditorUtility.DisplayDialog("Error", "Could not change script exec order!", "Ok");
            NoErrorHappened = false;
        }

        // 5. Add AkAudioListener component to camera
        if (!Settings.OldProject)
        {
            SetListener();
        }

        // 6. Enable "Run In Background" in PlayerSettings (PlayerSettings.runInbackground property)
        PlayerSettings.runInBackground = true;

#if !UNITY_5
        // 7. Install the Profile libraries of the installed platforms. This should actually be a change in the way we build unitypackages.
        if (!InstallAllPlatformProfilePlugins())
        {
            EditorUtility.DisplayDialog("Error", "Could not install some platform plugins!", "Ok");
            NoErrorHappened = false;
        }
#else
        AkPluginActivator.ActivateProfile();
#endif

        // 8. Verify DirectX is installed (windows only)
#if UNITY_EDITOR_WIN
        Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\DirectX\\");
        if (key == null)
        {
            EditorUtility.DisplayDialog("Warning", "Detected the DirectX End-User Runtime is not installed. You might have issues using the Windows version of the plugin", "Ok");
        }
#endif
        // 9. Activate WwiseIDs file generation, and point Wwise to the Assets/Wwise folder
        // 10. Change the SoundBanks options so it adds Max Radius information in the Wwise project
        if (!SetSoundbankSettings())
        {
            EditorUtility.DisplayDialog("Warning", "Could not modify Wwise Project to generate the header file!", "Ok");
        }

        // 11. Generate the WwiseIDs.cs file from the .h file
        // GenerateWwiseIDsCsFile();

        // 12. Refresh UI/Settings files.
        Repaint();

        // 13. Make sure the installed SDK matches the one that was build on the machine
        ValidateVersion();

        // 14. Move some files out of the assets folder
        // todo.

        // 15. Populate the picker
        AkWwiseProjectInfo.GetData(); // Load data
        if (!String.IsNullOrEmpty(Settings.WwiseProjectPath))
        {
            AkWwiseProjectInfo.Populate();
            AkWwisePicker.PopulateTreeview();
            if (AkWwiseProjectInfo.GetData().autoPopulateEnabled)
            {
                AkWwiseWWUBuilder.StartWWUWatcher();
            }
        }

        return(NoErrorHappened);
    }