segmentio / Analytics-CSharp

The hassle-free way to add Segment analytics to your C# written app (.Net/Xamarin/Unity).
MIT License
21 stars 8 forks source link

Unity Support! #13

Closed mattvv closed 1 year ago

mattvv commented 2 years ago

Hi Team!

I wanted to have a quick issue posted about Unity support, there a few things this library needs to be supported in Library, and I wanted to see if they were on the roadmap:

1) Decoupling newtonsoft from the library, Unity uses it's own version of newtonsoft json (3.0.1). It's pretty much intercompatable but if we wanted to us something like upm then it needs to be decoupled and distributed without the dll. 2) Support for UnityWebClient as well as HttpClient. Unity webGL builds just don't work with HttpClient. 3) compile to C# 9. Unity uses C# 9, so need to rollback the newer c# 10 features like inline namespaces.

wenxi-zeng commented 2 years ago

hi @mattvv sorry I missed your comment and thanks for these great feedbacks! please find the answers below:

  1. we are working on the decoupling newtonsoft dll now. should have a release that fixes this issue very soon.
  2. this is a new thing to us. thanks for bringing it to our attention. I have created a ticket internally and will be investigating on it.
  3. can you provide a sample list of compilation errors you had when using the library with c# 9? we kept compatibility in mind when we build the library. it should be .netstandard 2.0 compatible, which should work for unity straightly. inline namespaces shouldn't pass our unit tests.

also, can you please confirm how did you install this library in unity? and what's the version? (I believe it's through upm, but just want to make sure I don't miss anything)

thanks!

wenxi-zeng commented 2 years ago

hi @mattvv, the 1st issue has been fixed in 1.0.3.

wenxi-zeng commented 1 year ago

@mattvv just an update: this library now allows you customize the httpclient with your favorite network library, refer to UnityHTTPClient as an example (it's based on UnityWebRequest). however, due to the fact that this library is architected to be multi-threaded, it does not work with WebGL, since WebGL does not have multi-threading support at the moment.

I'm closing this issue out, since the three concerns are either addressed or not valid.