UniRx(Reactive Extensions for Unity) is re-implementation of .NET Reactive Extensions.
Welcome to the reactive game architecture!
This library is free and opensource on GitHub.
But, when I examined to run uniRX sample App on iOS, ExecutionEngineException error occurred.
Maybe, I think it is originated from Schedule function of CurrentThreadScheduler.
Does it means that uniRX is not compatible with iOS totally?
sorry, Iām unchecked iOS on latest version.
Iāll check and fix itās problmen as soon as possible.
Until then, if problem is only CurrentThreadScheduler,
modify CurrentThreadScheduler.cs
line:11 public static readonly IScheduler CurrentThread=new CurrentThreadScheduler();
to
public static readonly IScheduler CurrentThread=new ImmediateScheduler();
UniRx is basically based on Rx1.1.
But I have plan backport performance improvements of 2.0.
Thatās great news! <MVVM Framework
FYI, I made Rx, UI and MVVM library for .NET before. https://reactiveproperty.codeplex.com/
Itās another approach of ReactiveUI.
I hope this will help.
[edit]
going through the source, and all I can say is WOW. I was looking for a way to implement the observer design pattern, and this has so much more than I was initially thinkingā¦ very impressed.
Iām curious about your example, the behavior and ability to get a data stream back to the main thread (directly modifying New Sprite text property) is interesting. However, Iām having trouble wrapping my head around how I may change that so the āNew Spriteā could be an Observer of the āClickerā (NewBehaviourScript) Observableā¦ so that when it has completed itsā get of the data stream, it is pushed to āNew Spriteā and it does whatever it wants to with it.
I think once I get that concept better, I would be able to begin using Rx to solve some of my more complex ideas.
yes, that is what I was referencing. I think I understand, Iāll have to start working with the library to learn moreā¦ I think I have done all the reading I can to get a grasp, now it is just practice.
I do have one concern, related to lines:
var parallel = Observable.WhenAll(
ObservableWWW.Get("http://google.com/"),
ObservableWWW.Get("http://bing.com/"),
ObservableWWW.Get("http://yahoo.com/"));
parallel.Subscribe(xs =>
{
Debug.Log(xs[0]); // google
Debug.Log(xs[1]); // bing
Debug.Log(xs[2]); // yahoo
});
It seems the mainthread gets blocked causing the entire app to freeze until it completes LogStringToConsole. I enabled the code to permit the quad to spin in Update(), and it is really noticeable. Here is capture of performance:
The āLogStringToConsoleā takes 1.2 seconds to complete with a GC of 4.1MB (which is expected as it is all 3 websites), I am guessing that this is because it is happening on the main thread. Which I wouldnāt expect to have such a huge performance hit to do.
I think it could be having something to do with how large the output strings are in the returned array as I get errors when trying to view the results in the console. These are the following errors:
Hi, Today āUniRx - Reactive Extensions for Unity - 4.5ā has been accepted!
Big Change is defult timebased scheduler to MainThreadScheduler.
I think this to be good choice for Unity.
And new feature, UnityEvent.AsObservable for uGUI(Unity 4.6 Beta)
for example, button.onClick.AsObservable().Subscribe();
Add : ObservableWWW Overload(byte[ ] postData)
Add : Observable.Buffer Overload(windowBoundaries)
Add : LazyTask - yieldable value container like Task
Add : Observable.StartWith
Add : Observable.Distinct
Add : Observable.DelaySubscription
Add : UnityEvent.AsObservable - only for Unity 4.6 uGUI
Add : UniRx.UI.ObserveEveryValueChanged(Extension Method)
Add : RefCountDisposable
Add : Scheduler.MainThreadIgnoreTimeScale - difference with MainThreadScheduler, not follow Unity Timescale
Add : Scheduler.DefaultSchedulers - can configure default scheduler for any operation
Fix : DistinctUntilChanged iOS AOT issue.
Fix : Remove IObservable/IObserver/ISubjectās covariance/contravariance(Unity is not support)
Fix : UnityDebugSink throws exception when called from other thread
Fix : Remove compiler error for Windows Phone 8/Windows Store App
Breaking Change : MainThreadSchduler follow Unity Timescale
Breaking Change : All Timebased operatorās default scheduler changed to MainThreadScheduler
Breaking Change : Remove TypedMonoBehaviour.OnGUI for performance improvment
Performance Improvment : AsyncSubject[T]
Performance Improvment : CurrentThreadScheduler
Performance Improvment : MainThreadScheduler
Hi, i have a problem when i try to create a Singleton class to handle a double click, and subscribe the observable from other class. While clicking or double clicking i got the same result.
public class TapHandler: ObservableMonoBehaviour
{
private IObservable<Unit> mouseDown;
private static TapHandler instance;
public static TapHandler Instance
{
get {return instance ?? (instance = new GameObject("Manager").AddComponent<TapHandler>());}
}
public override void Awake()
{
this.mouseDown = this.UpdateAsObservable().Where(_ => Input.GetMouseButton(0));
base.Awake();
}
public IObservable<IList<Unit>> DoubleClick()
{
return this.mouseDown
.Buffer(this.mouseDown.Throttle(TimeSpan.FromMilliseconds(200)))
.Where(clx => clx.Count >= 2);
}
}
Subscribe from other class.
public class TrackerSenseBehaviour : ObservableMonoBehaviour {
public override void Awake(){
TapHandler.Instance.DoubleClick().Subscribe(o => Debug.Log("Double click"));
base.Awake();
}
}
Did i missed something, Rx pattern is relatively new to me. Iām still on the blues of itā¦