Skip to content

Commit 20e7349

Browse files
authored
unity: programmatic configuration changes (#5738)
1 parent f03a288 commit 20e7349

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed
Loading

src/platform-includes/configuration/config-intro/unity.mdx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ To provide a way to modify options programmatically, we've added `ScriptableOpti
1010

1111
![Options Configuration](unity-options-configuration.png)
1212

13-
<Note>
13+
There are two situations when a scriptable configuration object comes into play:
1414

15-
You can click the button _Create options configuration_ to get the C# scriptable object added to your project.
15+
* `Runtime Options Script` is executed on each app startup, right before the managed Sentry SDK is initialized (except for Android, iOS, and macOS native layers, which are already set up by that time).
16+
An example of how this can be used is for implementing your own filtering of events using the [BeforeSend](/platforms/unity/configuration/filtering/#using-platformidentifier-namebefore-send-) callback.
17+
(This callback only runs for events coming from C# scripts.)
1618

17-
</Note>
19+
* `Buildtime Options Script` - is executed by the Unity Editor during app build.
20+
Changes you make here affect the current build and also allow you to alter native platform build-time settings (Android, iOS, macOS).
1821

19-
Note that on mobile, changes to the options object done through `ScriptableOptionsConfiguration` do not affect events coming from the native layer. Additionally, a `BeforeSend` callback will only modify events coming from C# scripts.
22+
<Note>
23+
Not all options can be used on all platforms, also some may need to be changed at build-time, others at runtime.
24+
In most cases it's safe for both functions to run the same code.
25+
</Note>
2026

21-
The scriptable object contains a method `Configure` that is called right before the SDK is initialized and provides you with a place to, for example, implement your own filtering of events using the [BeforeSend](/platforms/unity/configuration/filtering/#using-platformidentifier-namebefore-send-) callback.
27+
<Note>
28+
You can click the button _New_ to create a scriptable object from template to get started.
29+
</Note>

0 commit comments

Comments
 (0)