Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Are dotNET Reactive Extensions compatible with Unity (yet)?

Discussion in 'Scripting' started by Ryunis, Dec 1, 2020.

  1. Ryunis

    Ryunis

    Joined:
    Dec 23, 2014
    Posts:
    24
    Historically there have been some issues with the official(?) implementation of ReactiveX (found here) and it's compatibility with Unity. This resulted in UniRx, a community effort to provide similar functionality and Unity specific API support.

    Unfortunately UniRx looks to be semi-abandoned and more importantly seems to lack many operators that make ReactiveX so powerful. Reactive Extensions are still being actively developed, so I wanted to ask if anyone knows if they are still incompatible?
     
    Macro likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Looking around I suspect you might be the one person most qualified and most motivated to determine this.

    I imagine setting up a quick test in an empty project might take less time than writing a post even!
     
  3. Ryunis

    Ryunis

    Joined:
    Dec 23, 2014
    Posts:
    24
    Not really, unfortunately.
    One of the issues of the official version, mentioned in the UniRx repo, concerns IL2CPP builds on iOS, which I have currently no way of testing.

    I assume the situation is similar to native async/await. You can get a simple example in the editor running perfectly fine, but that in no way guarantees all of the library features to work on all platforms without any weird quirks.

    I was hoping to hear from anyone who might have used it / is using it in production, because I'm not planning on writing 100s of unit tests, which I then deploy and run on all platforms.
     
    Last edited: Dec 1, 2020
    Macro likes this.
  4. Macro

    Macro

    Joined:
    Jul 24, 2012
    Posts:
    45
    @Ryunis We started trying to work this out a while ago and started putting together a test bed to see what would work with different platforms, I think we got a small amount of traction but it was a problem trying to get people with devices to test it on. From what I remember someone was using rx.net with xamarin on ios so they confirmed that you *can* use a lot of rx.net on AOT devices/scenarios but as IL2CPP is bespoke I don't know if it would work the same way.

    Anyway the repo is here: https://github.com/grofit/unity-rx-test

    With .net 6 on the horizon I am hoping by the time Unity adds support for that then hopefully this sort of AOT scenario stuff may improve a bit.
     
  5. YurySedyakin

    YurySedyakin

    Joined:
    Jul 25, 2018
    Posts:
    61
    For anyone interested, my test of Rx.NET 5.0 started working in Unity 2022.1 on both iOS and Android. It's a very simple one, just a few rx operators, but it used to fail in 2021.3
     
    xianzzz likes this.