Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unity: programmatic configuration changes #5738

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions src/platform-includes/configuration/config-intro/unity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ To provide a way to modify options programmatically, we've added `ScriptableOpti

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

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

You can click the button _Create options configuration_ to get the C# scriptable object added to your project.
* `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).
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.
(This callback only runs for events coming from C# scripts.)

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

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.
<Note>
Not all options can be used on all platforms, also some may need to be changed at build-time, others at runtime.
In most cases it's safe for both functions to run the same code.
</Note>

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.
<Note>
You can click the button _New_ to create a scriptable object from template to get started.
</Note>