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

documentation or support for integrating sentry in a injected package such as Harmony/BepInEx #1541

Open
zolantris opened this issue Jan 22, 2024 · 4 comments

Comments

@zolantris
Copy link

zolantris commented Jan 22, 2024

Hello, I'm trying to support a game mod that injects additional code into a Unity game. Currently looking for documentation or pointers on how to do this.

Generic background information

  1. This is for a game mod using BepInEx **with** Harmony to inject code into the runtime.
  2. I'm looking for a SDK that will provide benchmarks/logging services for the new classes/code written.
  3. The project currently has a Unity project which is used to create asset bundles, but the main codebase exists outside of the assetbundle/unity project.

Questions

  1. Does this project fall under the scope of sentry-unity or sentry-Csharp-dot-net integration as this would not utilize UPM
  2. Does sentry support integrating Sentry within a C# runtime with unity? With sentry-unity I only see a way to install the package into a project, but I do not see a way to directly integrate the package using something such as nuget or directly copy pasting and initializing sentry-unity within the sector of my code.
  3. Is there a way to include sentry in my asset bundle or do I need to dynamically inject it and/or include the unity version of the package as a reference in my C# package?

Solution / Workaround

  1. Directly bring references of Sentry.Unity into my project. (e.g. from release 1.8.0)
  2. Move the entire Sentry Package into the target directory for debugging. (WIP, confirming which dependencies are truly required for Sentry.Unity to function)
  3. Package required Sentry libs alongside my project.
@bitsandfoxes
Copy link
Contributor

bitsandfoxes commented Jan 22, 2024

Hey there and thanks for reaching out!
Generally, we don't advise using the Sentry SDK in libraries except in special cases like exporting the Unity game as a library to embed it.
Additionally, the SDK consists of editor and runtime scripts. We kind of heavily hook into and modify the build process for the SDK to be properly integrated on every level.
What might work is including the .NET SDK and even that would give you only limited access to capturing unsymbolicated events.

Sorry to not be able to give you any better news.

@zolantris
Copy link
Author

zolantris commented Jan 23, 2024

Thanks, for the information.

I had concerns especially if every mod package did this.

Would sentry break at runtime (with multi init calls) and/or would other packages work with their individual scope registry and SentrySdk.init call?

Many users download 100s of these types of mods so it could get complex fast if sentry were used in more than 1 project.

I looks like I should only integrate sentry for a few test users so we can troubleshoot problems easier.

@zolantris
Copy link
Author

Noting the scope of this is literally every popular unity game (that has mods).

It would be great to have better logging tools available for mod authors but the logging scope should be retained within their namespaces.

@bitsandfoxes
Copy link
Contributor

The issue of multiple instances of Sentry within one application is precisely why we don't advise adding the SDK to libraries. That behaviour is basically undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: No status
Development

No branches or pull requests

3 participants