示例#1
0
        static void Init()
        {
            Debug.Log("Android Performance Tuner Initializer");

            setupConfig   = FileUtil.LoadSetupConfig();
            devDescriptor = CreateDescriptor();

            // When a new package is imported in Unity 2018, EditorBuildSettings.scenes are not updated yet when
            // Initializer() is called, thus the .proto file does not reflect possible changes in the scenes.
            // This callback creates the .proto file when the package has finished importing and the
            // EditorBuildSettings are up to date.
#if UNITY_2018
            AssetDatabase.importPackageCompleted += (packageName) =>
            {
                CreateProtoFile(devDescriptor);
            };
#endif

            enumInfoHelper = new EnumInfoHelper(devDescriptor.fileDescriptor);
            protoFile      = CreateProtoFile(devDescriptor);

            CreateAsmdefFile();

            projectData = new ProjectData();
            projectData.LoadFromStreamingAssets(devDescriptor);

            EditorBuildSettings.sceneListChanged += () =>
            {
                Debug.Log("Android Performance Tuner SceneListChanged");
                UpdateSceneEnum();
            };

            if (!FidelityBuilder.builder.valid)
            {
                initMessage = "Fidelity message is not generated yet or your project is still compiling. " +
                              "If this message persists, try to re-import the plugin and generated assets." +
                              "\n[macOS] Check if protoc compiler can be opened. " +
                              "In the Finder locate protoc binary in AndroidPerformanceTuner/Editor/Protoc, " +
                              "control-click the binary, choose Open and then click Open. ";
                Debug.Log(initMessage);
                valid = false;
                return;
            }

            UpdateFidelityMessages();
            CheckForLoadingStateInAnnotation();

            // TODO(kseniia): Check for possible inconsistencies in the data, set to false if any found
            // TODO(kseniia): or remove "valid" if all problems could be fixed in-place
            valid = true;
        }
        /// <summary>
        ///     Create default fidelity messages with quality settings if default mode is enabled.
        /// </summary>
        /// <param name="path">path to android project</param>
        public void OnPostGenerateGradleAndroidProject(string path)
        {
            var setupConfig = FileUtil.LoadSetupConfig();

            if (setupConfig.pluginEnabled)
            {
                Debug.Log("Android Performance Tuner is enabled, copying files to android project...");
                FileUtil.CopyTuningforkFilesToAndroidProject(path);
                if (!setupConfig.useAdvancedFidelityParameters)
                {
                    Debug.Log("Android Performance Tuner is using default fidelity parameters, generating default quality levels...");
                    FileUtil.SaveFidelityMessagesInApk(path, MessageUtil.FidelityMessagesWithQualityLevels());
                }
            }
        }
示例#3
0
        static Initializer()
        {
            Debug.Log("Android Performance Tuner Initializer");

            setupConfig = FileUtil.LoadSetupConfig();

            devDescriptor = CreateDescriptor();

            protoFile = CreateProtoFile(devDescriptor);

            CreateAsmdefFile();

            projectData = new ProjectData();
            projectData.LoadFromStreamingAssets(devDescriptor);

            enumInfoHelper = new EnumInfoHelper(devDescriptor.fileDescriptor);

            EditorBuildSettings.sceneListChanged += () =>
            {
                Debug.Log("Android Performance Tuner SceneListChanged");
                UpdateSceneEnum();
            };

            if (!FidelityBuilder.builder.valid)
            {
                initMessage = "Fidelity message is not generated yet or your project is still compiling. " +
                              "If this message persists, try to re-import the plugin and generated assets." +
                              "\n[macOS] Check if protoc compiler can be opened. " +
                              "In the Finder locate protoc binary in AndroidPerformanceTuner/Editor/Protoc, " +
                              "control-click the binary, choose Open and then click Open. ";
                Debug.Log(initMessage);
                valid = false;
                return;
            }

            UpdateFidelityMessages();

            // TODO(kseniia): Check for possible inconsistencies in the data, set to false if any found
            // TODO(kseniia): or remove "valid" if all problems could be fixed in-place
            valid = true;
        }