Skip to content

Commit

Permalink
feat: Added custom options configuration to samples (#568)
Browse files Browse the repository at this point in the history
* added CustomOptionsConfiguration sample

* updated snapshot

* added additional comment

* updated CHANGELOG.md

* Update samples/unity-of-bugs/Assets/Scripts/CustomOptionsConfiguration.cs

Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>

* Update samples/unity-of-bugs/Assets/Scripts/CustomOptionsConfiguration.cs

Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>

Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
  • Loading branch information
bitsandfoxes and bruno-garcia authored Feb 16, 2022
1 parent de29836 commit fce257a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features

- Samples include programmatic options configuration snippet ([#568](https://github.com/getsentry/sentry-unity/pull/568))
- Support for programmatic options configuration ([#564](https://github.com/getsentry/sentry-unity/pull/564))

## 0.10.0
Expand Down
25 changes: 25 additions & 0 deletions samples/unity-of-bugs/Assets/Scripts/CustomOptionsConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Sentry.Unity;
using UnityEngine;

[CreateAssetMenu(fileName = "Assets/Resources/Sentry/CustomOptionsConfiguration", menuName = "Sentry/CustomOptionsConfiguration", order = 999)]
public class CustomOptionsConfiguration : ScriptableOptionsConfiguration
{
// This method gets called when you instantiated the scriptable object and added it to the configuration window
public override void Configure(SentryUnityOptions options)
{
// NOTE: Changes to the options object done here will not affect native crashes. The native SDKs only take
// options defined in the Sentry editor configuration window.
// Learn more at: https://docs.sentry.io/platforms/unity/native-support/configuration/

options.BeforeSend = sentryEvent =>
{
if (sentryEvent.Tags.ContainsKey("SomeTag"))
{
// Don't send events with a tag SomeTag to Sentry
return null;
}
return sentryEvent;
};
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/Scripts.Tests/package-release.zip.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ Samples~/unity-of-bugs/Scripts/AdditionalButtons.cs
Samples~/unity-of-bugs/Scripts/AdditionalButtons.cs.meta
Samples~/unity-of-bugs/Scripts/BugFarmButtons.cs
Samples~/unity-of-bugs/Scripts/BugFarmButtons.cs.meta
Samples~/unity-of-bugs/Scripts/CustomOptionsConfiguration.cs
Samples~/unity-of-bugs/Scripts/CustomOptionsConfiguration.cs.meta
Samples~/unity-of-bugs/Scripts/NativeSupport.meta
Samples~/unity-of-bugs/Scripts/SceneButtons.cs
Samples~/unity-of-bugs/Scripts/SceneButtons.cs.meta
Expand Down

0 comments on commit fce257a

Please sign in to comment.