コード例 #1
0
        private static void ConfigureOptions(Dictionary <string, string> args, [CallerMemberName] string functionName = "")
        {
            Debug.LogFormat("{0}: Invoking SentryOptions", functionName);

            if (!EditorApplication.ExecuteMenuItem("Tools/Sentry"))
            {
                throw new Exception($"{functionName} failed: Menu item 'Tools -> Sentry' not found. Was the Sentry UPM package installed?");
            }

            var optionsWindow = EditorWindow.GetWindow <SentryWindow>();
            var options       = optionsWindow.Options;

            if (options is null)
            {
                throw new InvalidOperationException($"{functionName} failed: SentryOptions not found");
            }
            Debug.LogFormat("{0}: Found SentryOptions", functionName);

            var value = "";

            if (args.TryGetValue("sentryOptions.Dsn", out value))
            {
                Debug.LogFormat("{0}: Configuring DSN to {1}", functionName, value);
                options.Dsn = value;
            }

            if (args.TryGetValue("sentryOptionsScript", out value))
            {
                Debug.LogFormat("{0}: Configuring Options Script to {1}", functionName, value);
                OptionsConfigurationDotNet.SetScript(value);
            }

            optionsWindow.Close();
            Debug.LogFormat("{0}: Sentry options Configured", functionName);
        }
コード例 #2
0
        public static void Display(ScriptableSentryUnityOptions options)
        {
            GUILayout.Label("Programmatic Options Configuration", EditorStyles.boldLabel);

            EditorGUILayout.Space();

            EditorGUILayout.HelpBox("The options configuration allows you to programmatically modify " +
                                    "the Sentry options object during runtime initialization of the SDK. " +
                                    "This allows you to override configuration otherwise unavailable from the " +
                                    "editor UI, e.g. set a custom BeforeSend callback. \n\n" +
                                    // TODO other platforms
                                    // "Because Sentry Unity integration includes both managed C# Unity SDK and a " +
                                    // "platform specific one, you can specify the respective overrides separately.\n\n" +
                                    "You can either select an existing script, or create a new one by clicking the " +
                                    "'New' button, which will create one from a template at a selected location.",
                                    MessageType.Info);

            EditorGUILayout.Space();

            OptionsConfigurationDotNet.Display(options);
        }