sentry-unity
sentry-unity copied to clipboard
Sentry Configured via Code sends no events to API
Environment
How do you use Sentry? SaaS
Which version of the SDK? 0.9.2
Which version of Unity? 2020.3.25f1
Is this happening in Unity (editor) or on a player like Android, iOS, Windows? iOS & Android
Steps to Reproduce
- Set Sentry as disabled in Sentry window inside Editor.
- Configure Sentry using a
SentryOptionsobject (activate, setup - Pass this
SentryOptionsobject to Sentry.Init()
Expected Result
SentrySDK runs in C# code, sending events to the remote API in both Editor and on devices (e.g. iOS)
Actual Result
What actually happened. Maybe a screenshot/recording? Maybe some logs?
SentrySDK sends events and performance metrics as expected when in Editor. SentrySDK DOES NOT send events OR performance metrics in builds.
Any logs or screenshots
runtime_logs_with_sentry_diagnostics.txt
*edit: Added logs
On the latest version we've added a new way to be able to programatically change the options. So you don't need to "choose" between the Unity editor integration and the programatic configuration. We documented it here: https://docs.sentry.io/platforms/unity/configuration/options/
Now I realize we're missing a Migration Guide entry about how to go from the previous approach to the new one. I'll get one up on our docs. But in short, you no longer need/should call SentryUnity.Init by yourself. Instead, rely on the Sentry Unity editor window to add settings there, and you can use the scriptable object to add additional programatic things like BeforeSend. That will make sure you have native crash support too (though the C# programatic changes to the SentryOptions object won't affect events coming from the native layers. We'll provide yet another solution that requires more work on user side if that flexibility, but should be needed in most cases).
I saw this option (and have another ticket about my inability to compile with the latest version #588 ).
If we shouldn't be using this Init method, then it should not be exposed via the SDK's API. It's misleading to have that pathway available when it does not work as expected.
If that's not possible due to supporting .NET generally and inside Unity specifically, then the documentation should make this obnoxiously clear.
You can absolutely use SentryUnity.Init. The "only" downside is that we cannot provide you with native support right now, if you chose to do so. But if you don't care about that and you just want to capture C# errors and you want to initialize the SDK yourself then this is an option.
Note that we do plan to support native support in comination with letting the user initialize the SDK in the future. We're just not there yet.
For this particular issue I think the reason the events don't show up has got to do with the CompressionLevel. I saw in your logs that you've set it to Optimal, could you try NoCompression and see if that works for you?
Changing to no compression does appear to work. Why would Optimal compression not work on iOS?
It's not an iOS related issue but due to simply not working on IL2CPP. But we just should not provide options that simply don't work the majority of the time.