UniRx: Extension method in UniRx.ObservableExtensions conflict with System.Reactive
In Unity 2021.2.12 (and also happening on 2022.1.0b8), the extension methods in ObservableExtensions are conflicting with the extension methods pulled in by System.Reactive.
Various error messages along the lines of: The call is ambiguous between the following methods or properties: 'UniRx.ObservableExtensions.Subscribe<T>(System.IObservable<T>)' and 'System.ObservableExtensions.Subscribe<T>(System.IObservable<T>)' are now appearing whenever there is the using UniRx; using System; appearing in the same file.
Is there a suggested workaround / solution to this issue?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 24
- Comments: 42 (1 by maintainers)
It’s fixed internally on Unity’s trunk and is awaiting backport to the 2021.3 branch. I requested an update earlier today on when the backport will be happening.
2021.3.0f1 is out - but this issue is still not fixed. @Nezz: Any news from your source?
I’ve just checked with 2021.3.1f1, it’s still not fixed!
The PR for the backport was submitted yesterday for 2021.3. If all goes well, it should be merged and released fairly quickly.
Still not fixed in 2021.2.19f1.
Oooh now the page says:
Fixed in: 2021.3.3f1 Fixed in: 2022.1.1f1
😃
Some news:
A quick workaround of this issue would be put
using UniRxintonamespace.For those code without
namespaceyou have to removeusing Systemas @peterdijkstra suggested.2021.3.2, it’s still not fixed!
I opened a ticket with Unity about this.
This works. If you happen to be using
using System;as well, put it outside of the namespace, then you can use it as normal:I’ve tried on Unity 2021.2.13f1. API Compatibillity Level: .NET Standard 2.1 is worked. API Compatibillity Level: .NET Framework, conflicts.
Indeed, it implicitly refers to
System.Reactive.*.dll. I think it’s a bug in Unity, so until there’s an official announcement (references added, etc.), I’ll wait and see.@kLy: The issue mentions, that it will be fixed in 2021.3:
This issue was mentioned in Unity 2022.2a release notes.
It’s still the same in 2021.2.18f1.
I’ve just checked out 2021.2.17f1. This issue is still in this version.
Still broken in 2021.2.15f1, keep staying in 2021.2.11f1
This is the latest I got:
It’s an enterprise support ticket, no point in linking it 😃
Woohoo! 2021.3.3 just released! https://unity3d.com/unity/whats-new/2021.3.3
And it includes the fix:
Tested on my project. Working! 😄
my unity editor version is 2022.1.0b16,when i switch to il2cpp + .net standard2.1(pc platform), this compilation error disappears
A really preliminary test on 2022.1.1f seems to show that it’s fixed. I’m just going to assume that it now works and close this issue
I have removed all
using System;lines in files where this broke, and just changedIDisposabletoSystem.IDisposableetc. That also works, but might be a hassle if you use UniRx a tonFor what it’s worth, this wasn’t a problem with 2021.2.8