Unity 3D and you
Quick tutorial for using UniRx
by Sam Megidov
- It's a re-implementation of NET Reactive Extensions (ReactiveX) for Unity3D by Yoshifumi Kawai.
ReactiveX is a combination of the best ideas from the Observer pattern, the Iterator pattern, and functional programming.
So what’s the use of it?
- It makes your life easier !
- Makes all properties and actions plug-and-play.
- Clean and more manageable code.
Let's see some examples
Update score text every time score changes
Now every time score changes,
we update text in the scoreText GameObject.
No need to put that code into an update loop !
How about a highscore?
- That's it !
- It compares every value and gets the highest number.
score .Scan(int.MinValue, Mathf.Max) .SubscribeToText (highscoreText)
How about something more complicated?
Accumulates amount of added score with a window of 500ms.
- Ultra fast performance !
- Make sequences, delay them, buffer them, and more !
- Works on all platforms, full source included.
- Constantly updated, 2 years of updates and counting.
- Still lacks some operators, but most useful ones are already there.
- Not enough documentation for game development.
- Takes a bit of time to get used to it.
Reactive Programming, Unity 3D and you
By Sam Megidov