diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7e6069f4..9e25672e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
### Features
- Auto-enable required project settings ([#260](https://github.com/getsentry/sentry-godot/pull/260))
+- Add `disabled_in_editor_play` option ([#262](https://github.com/getsentry/sentry-godot/pull/262))
### Fixes
diff --git a/doc_classes/SentryOptions.xml b/doc_classes/SentryOptions.xml
index 158b2357..1883bccc 100644
--- a/doc_classes/SentryOptions.xml
+++ b/doc_classes/SentryOptions.xml
@@ -52,6 +52,9 @@
If [code]true[/code], the SDK will not initialize in the Godot editor.
+
+ If [code]true[/code], the SDK will not initialize when the project is run from within the Godot editor. This differs from [member disabled_in_editor] which prevents initialization when working in the editor itself.
+
The application's distribution. Distributions are used to disambiguate build or deployment variants of the same release of an application.
diff --git a/project/test/suites/test_options.gd b/project/test/suites/test_options.gd
index 713c970f..99414e2f 100644
--- a/project/test/suites/test_options.gd
+++ b/project/test/suites/test_options.gd
@@ -14,6 +14,7 @@ func before_test() -> void:
func test_bool_properties(property: String, test_parameters := [
["enabled"],
["disabled_in_editor"],
+ ["disabled_in_editor_play"],
["debug"],
["attach_log"],
["attach_screenshot"],
diff --git a/src/sentry/sentry_options.cpp b/src/sentry/sentry_options.cpp
index 2bc21826..7f2cd1dc 100644
--- a/src/sentry/sentry_options.cpp
+++ b/src/sentry/sentry_options.cpp
@@ -59,6 +59,7 @@ void SentryOptions::_define_project_settings(const Ref &p_options
_define_setting("sentry/options/enabled", p_options->enabled);
_define_setting("sentry/options/disabled_in_editor", p_options->disabled_in_editor, false);
+ _define_setting("sentry/options/disabled_in_editor_play", p_options->disabled_in_editor_play);
_requires_restart("sentry/options/disabled_in_editor");
_define_setting("sentry/options/dsn", p_options->dsn);
_define_setting("sentry/options/release", p_options->release, false);
@@ -102,6 +103,7 @@ void SentryOptions::_load_project_settings(const Ref &p_options)
p_options->enabled = ProjectSettings::get_singleton()->get_setting("sentry/options/enabled", p_options->enabled);
p_options->disabled_in_editor = ProjectSettings::get_singleton()->get_setting("sentry/options/disabled_in_editor", p_options->disabled_in_editor);
+ p_options->disabled_in_editor_play = ProjectSettings::get_singleton()->get_setting("sentry/options/disabled_in_editor_play", p_options->disabled_in_editor_play);
p_options->dsn = ProjectSettings::get_singleton()->get_setting("sentry/options/dsn", p_options->dsn);
p_options->dist = ProjectSettings::get_singleton()->get_setting("sentry/options/dist", p_options->dist);
@@ -175,6 +177,7 @@ void SentryOptions::remove_event_processor(const Ref &p_pr
void SentryOptions::_bind_methods() {
BIND_PROPERTY(SentryOptions, PropertyInfo(Variant::BOOL, "enabled"), set_enabled, is_enabled);
BIND_PROPERTY(SentryOptions, PropertyInfo(Variant::BOOL, "disabled_in_editor"), set_disabled_in_editor, is_disabled_in_editor);
+ BIND_PROPERTY(SentryOptions, PropertyInfo(Variant::BOOL, "disabled_in_editor_play"), set_disabled_in_editor_play, is_disabled_in_editor_play);
BIND_PROPERTY(SentryOptions, PropertyInfo(Variant::STRING, "dsn"), set_dsn, get_dsn);
BIND_PROPERTY(SentryOptions, PropertyInfo(Variant::STRING, "release"), set_release, get_release);
BIND_PROPERTY(SentryOptions, PropertyInfo(Variant::STRING, "dist"), set_dist, get_dist);
diff --git a/src/sentry/sentry_options.h b/src/sentry/sentry_options.h
index 5772b702..ef1a37e9 100644
--- a/src/sentry/sentry_options.h
+++ b/src/sentry/sentry_options.h
@@ -50,6 +50,7 @@ class SentryOptions : public RefCounted {
bool enabled = true;
bool disabled_in_editor = true;
+ bool disabled_in_editor_play = false;
String dsn = "";
String release = "{app_name}@{app_version}";
String dist = "";
@@ -97,6 +98,9 @@ class SentryOptions : public RefCounted {
_FORCE_INLINE_ bool is_disabled_in_editor() const { return disabled_in_editor; }
_FORCE_INLINE_ void set_disabled_in_editor(bool p_disabled_in_editor) { disabled_in_editor = p_disabled_in_editor; }
+ _FORCE_INLINE_ bool is_disabled_in_editor_play() const { return disabled_in_editor_play; }
+ _FORCE_INLINE_ void set_disabled_in_editor_play(bool p_disabled_in_editor_play) { disabled_in_editor_play = p_disabled_in_editor_play; }
+
_FORCE_INLINE_ String get_dsn() const { return dsn; }
_FORCE_INLINE_ void set_dsn(const String &p_dsn) { dsn = p_dsn; }
diff --git a/src/sentry/sentry_sdk.cpp b/src/sentry/sentry_sdk.cpp
index caacc11a..4144f436 100644
--- a/src/sentry/sentry_sdk.cpp
+++ b/src/sentry/sentry_sdk.cpp
@@ -242,6 +242,11 @@ void SentrySDK::_initialize() {
sentry::util::print_debug("Sentry SDK is disabled in the editor. Tip: This can be changed in the project settings.");
}
+ if (!Engine::get_singleton()->is_editor_hint() && OS::get_singleton()->has_feature("editor") && SentryOptions::get_singleton()->is_disabled_in_editor_play()) {
+ should_enable = false;
+ sentry::util::print_debug("Sentry SDK is disabled during editor play. Tip: This can be changed in the project settings.");
+ }
+
if (should_enable) {
#ifdef NATIVE_SDK
internal_sdk = std::make_shared();