Environment support
We have debug builds and release builds and I would like to define those as environments but this SDK does not seem to support that.
https://docs.sentry.io/enriching-error-data/environments/?platform=csharp
https://github.com/getsentry/sentry-unity/issues/15 would likely solve this issue, if I'm not mistaken.
getsentry/sentry-unity#15 would solve this problem but we're not scheduled to ship that as a supported SDK at this point. We can add Environment to this SDK for the time being.
For now let's just add it to this SDK.
I was able to use o.Environment in the same way as o.Debug is being used, in SDK from getsentry/sentry-unity#15 without any problem.
I feel getsentry/sentry-unity#15 is a great approach and I'm hoping it could be supported in the future. Just curious, what's blocking support for that SDK at the moment, except the needs a few tweaks to make it configurable?
We need to test it in different platforms. Have a package depending on UnityEngine to be able to read context data from Unity. Have some CI to make sure everything works fine. We'll also want to have the right hooks to support adding native SDKs like sentry-android and sentry-cocoa to capture crashes from native libraries in those platforms.
Stacktraces when using Mono might not be symbolicated unless PDBs are deployed with the app which is not common in this type of client apps like games. So we need to add server side symbolication to capture those use cases.
Need to verify IL2CPP use cases. The linker will drop some of the SDK code so we need to make sure we get the link.xml config right.
There's a lot we want/can do, we just weren't able to prioritize this yet. If someone with the know-how is interested in getting involved. please reach out.
getsentry/sentry-unity#15 would solve this problem but we're not scheduled to ship that as a supported SDK at this point. We can add Environment to this SDK for the time being.
For now let's just add it to this SDK.
Has this been added? It is not clear to me how to initialize the Environment in the current state of the Unity SDK.
@henriqueranj We're about to ship a preview of a new SDK that has this resolved (it relies on the .NET SDK). Is this something you'd be able to help us take a test drive?
Also, what platforms do you target? iOS, Android, Windows .. ?
@bruno-garcia looking forward to that preview. At this moment we use Sentry for our Unity Windows, MacOS, Android and iOS platforms (over two projects).
Sounds cool. For capturing C# errors it should already work for all those platforms. But for native plugins, I've experimented mainly with Android.
I just recorded a video where I describe the idea and show what I have so far:
https://www.youtube.com/watch?v=bHc4QMlV8bM
I'd be happy to take feedback while continuing with this, feel free to reach out on Discord, #unity channel
Both iOS and Android native support is available: https://github.com/getsentry/sentry-unity Environment is propagated to the native layer so events coming from C# or native will include it.