SlideShare a Scribd company logo
Reactive Programming by UniRx
for Asynchronous & Event Processing
2014/07/30
Yoshifumi Kawai - @neuecc
Self Introduction
@
CTO
C# 5.0 + .NET Framework 4.5 + ASP.NET MVC 5
C# Web
@
Microsoft MVP for Visual C# / C#
Web http://neue.cc/
Twitter @neuecc
What’s Reactive Programming?
Functional Reactive Programming
http://en.wikipedia.org/wiki/Functional_reactive_programming
Excel ……
Reactive Extensions
FRP (Haskell )
2009 .NET Reactive Extensions
Functional Reactive Programming
http://en.wikipedia.org/wiki/Functional_reactive_programming
Excel ……
Reactive Extensions
FRP (Haskell )
2009 .NET Reactive Extensions
UniRx
ReactiveExtensions(Rx) Unity
Gartner’s Hype Cycle
2013 Application Architecture/Application Development
On the Rise - Reactive Programming
Technology Radar Languages & Framework
ThoughtWorks Technology Radar July 2014
Rx ADOPT OK
TRIAL
ASSESS
HOLD
Across Languages
RxJava
Netflix for Java/Scala
ReactiveCocoa
GitHub 5073 for Objective-C
RxJS/bacon.js
JavaScript
RxJS bacon.js
Reactive Programming by UniRx for Asynchronous & Event Processing
UniRx
UniRx 100
Asset Store
Reactive Programming
Reactive Extensions
RxJava Wiki
UniRx - Reactive Extensions for Unity
Reactive Extensions(Rx) is
LINQ
C# LINQ
LINQ(to Objects) C#
Rx LINQ
LINQ
Reactive
Programming
Rx
UniRx is
.NET(C#) Rx Unity
https://github.com/neuecc/UniRx
http://u3d.as/7tT (Asset Store, Price : FREE)
Rx + Unity
C# ……
https://rx.codeplex.com/
Bart De Smet Microsoft
Unity :)
Q
C# LINQ Rx 5
……
3 @IT
http://www.atmarkit.co.jp/fdotnet/introrx/introrx_01/introrx_01_01.html
AOT Safe
LINQ iOS AOT
Unity + iOS AOT
http://neue.cc/2014/07/01_474.html
Reactive Extensions
is
LINQ to Events
LINQ to Asynchronous
Event is Observable Sequence
Rx
IObservable<T> time
OnTap
3 Tap
5 Tap
1 Tap
IEnumerable <-> IObservable
IObservable<T> time
IEnumerable<T> length
IEnumerable<T> length
.Where(x => x % 2 == 0)
IObservable<T> time
.Where(x => x % 2 == 0)
Where
LINQ
Push Event Stream
Event Processing
Interactive/Visualize
Internet of Things
Push
Kinect
Oculus
Twitter Streaming
PubSub, WebSocket
Logs are Stream(Fluentd, Amazon Kinesis, Azure Event Hubs)
MonoBehaviour Update , OnMouseClick, etc...
LINQ
LINQ
LINQ
LINQ
Better EventHandling
Limitations of .NET Events
//
public event Action<int> OnHitDamage;
//
player.OnHitDamage += (damage) =>
{
if (damage >= 1000)
{
// " "
}
};
player.OnHitDamage -= /* */
Observable Sequence to the Rescue
IObservable<int> onHitDamage = player.OnHitDamage;
var criticalHit = onHitDamage
.Where(x =>x >= 1000);
var subscription = criticalHit.Subscribe(damage => /* ... */);
subscription.Dispose();
LINQ
Lifecycle Resource Management
// Disposable
CompositeDisposable subscriptions = new CompositeDisposable();
void Awake()
{
var player = new Player();
var enemy1 = new Player();
var enemy2 = new Player();
//
player.OnHitDamage.Subscribe().AddTo(subscriptions);
enemy1.OnHitDamage.Subscribe().AddTo(subscriptions);
enemy2.OnHitDamage.Subscribe().AddTo(subscriptions);
}
void OnDestroy()
{
//
subscriptions.Dispose();
}
Curing
Your
Asynchronous
Programming
Blues
yield return is awaitable
IEnumerator GetBingText()
{
var www = new WWW("http://bing.com/");
yield return www; //
Debug.Log(www.text);
}
It’s Unity’s awesome feature!
But...
IEnumerator GetGoogle()
{
var www = new WWW("http://google.com/");
yield return www;
}
IEnumerator OnMouseDown()
{
try
{
//
yield return StartCoroutine(GetGoogle());
}
catch
{
}
}
IEnumerator
yield return try-catch
IEnumerator GetGoogle(Action<string> onCompleted, Action<Exception> onError)
{
var www = new WWW("http://google.com/");
yield return www;
if (!www.error) onError(new Exception(www.error));
else onCompleted(www.text);
}
……(JavaScript )
IEnumerator
Rx Unity
ObservableWWW.Get("http://google.co.jp/")
.SelectMany(x => ObservableWWW.Get(x)) //
.Retry(3) // 3
.Subscribe(
x => Debug.Log(x), //
ex => Debug.LogException(ex)); //
Rx
x x
x
Why can Rx apply to asynchronous?
x
IEnumerable<T>
IObservable<T>
IObservable<T> time
event
async
IE<T>
Why can Rx apply to asynchronous?
x
IEnumerable<T>
IObservable<T>
IObservable<T> time
event
async
IE<T>
Orchestrate Rx
var parallel = Observable.WhenAll(
ObservableWWW.Get("http://google.com/"),
ObservableWWW.Get("http://bing.com/"),
ObservableWWW.Get("http://unity3d.com/"));
parallel.Subscribe(xs =>
{
Debug.Log(xs[0].Substring(0, 100)); // google
Debug.Log(xs[1].Substring(0, 100)); // bing
Debug.Log(xs[2].Substring(0, 100)); // unity
});
IObservable<T> time
IObservable<T> time
WhenAll
Observable.WhenAll(
ObservableWWW.Get(),
ObservableWWW.Get(),
ObservableWWW.Get())
Subscribe(xs => xs[0], xs[1], xs[2])
Conclusion
Reactive Programming
UniRx
Available Now
GitHub - https://github.com/neuecc/UniRx/
Asset Store(FREE) – http://u3d.as/7tT
Update
(v4.4)

More Related Content

PPTX
未来のプログラミング技術をUnityで -UniRx-
PDF
UniRx完全に理解した
PDF
Reactive extensions入門v0.1
PDF
ライブラリ作成のすゝめ - 事例から見る個人OSS開発の効能
PPTX
UniRxでMV(R)Pパターン をやってみた
PDF
Task vs Observable
PDF
コールバックと戦う話
PPTX
若輩エンジニアから見たUniRxを利用したゲーム開発
未来のプログラミング技術をUnityで -UniRx-
UniRx完全に理解した
Reactive extensions入門v0.1
ライブラリ作成のすゝめ - 事例から見る個人OSS開発の効能
UniRxでMV(R)Pパターン をやってみた
Task vs Observable
コールバックと戦う話
若輩エンジニアから見たUniRxを利用したゲーム開発

What's hot (20)

PDF
UE4でマルチプレイヤーゲームを作ろう
PDF
Riderはいいぞ!
PDF
【Unity道場】AssetGraph入門 〜ノードを駆使しててUnityの面倒な手作業を自動化する方法〜
PDF
【Unite Tokyo 2019】Unityだったら簡単!マルチプレイ用ゲームサーバ開発 ~実践編~
PDF
Observable Everywhere - Rxの原則とUniRxにみるデータソースの見つけ方
PDF
【Unity】 Behavior TreeでAIを作る
PDF
XAML入門
PDF
CEDEC 2018 最速のC#の書き方 - C#大統一理論へ向けて性能的課題を払拭する
PDF
【CEDEC2018】CPUを使い切れ! Entity Component System(通称ECS) が切り開く新しいプログラミング
PDF
UniTask入門
PDF
MagicOnion入門
PDF
GTMF 2017:Unityプロファイリングマニアクス ユニティ・テクノロジーズ・ジャパン合同会社
PDF
Deep Dive async/await in Unity with UniTask(EN)
PDF
インタフェース完全に理解した
PDF
Observableで非同期処理
PPTX
FINAL FANTASY XVにおけるPhoton利用事例 - Photon運営事務局 GTMF 2018 OSAKA / TOKYO
PDF
ObserverパターンからはじめるUniRx
PPTX
【CEDEC2018】Scriptable Render Pipelineを使ってみよう
PPTX
MVPパターンによる設計アプローチ「あなたのアプリ報連相できてますか」
PPTX
[데브루키/141206 박민근] 유니티 최적화 테크닉 총정리
UE4でマルチプレイヤーゲームを作ろう
Riderはいいぞ!
【Unity道場】AssetGraph入門 〜ノードを駆使しててUnityの面倒な手作業を自動化する方法〜
【Unite Tokyo 2019】Unityだったら簡単!マルチプレイ用ゲームサーバ開発 ~実践編~
Observable Everywhere - Rxの原則とUniRxにみるデータソースの見つけ方
【Unity】 Behavior TreeでAIを作る
XAML入門
CEDEC 2018 最速のC#の書き方 - C#大統一理論へ向けて性能的課題を払拭する
【CEDEC2018】CPUを使い切れ! Entity Component System(通称ECS) が切り開く新しいプログラミング
UniTask入門
MagicOnion入門
GTMF 2017:Unityプロファイリングマニアクス ユニティ・テクノロジーズ・ジャパン合同会社
Deep Dive async/await in Unity with UniTask(EN)
インタフェース完全に理解した
Observableで非同期処理
FINAL FANTASY XVにおけるPhoton利用事例 - Photon運営事務局 GTMF 2018 OSAKA / TOKYO
ObserverパターンからはじめるUniRx
【CEDEC2018】Scriptable Render Pipelineを使ってみよう
MVPパターンによる設計アプローチ「あなたのアプリ報連相できてますか」
[데브루키/141206 박민근] 유니티 최적화 테크닉 총정리
Ad

Viewers also liked (20)

PDF
UniRx - Reactive Extensions for Unity
PDF
The History of Reactive Extensions
PDF
AWS + Windows(C#)で構築する.NET最先端技術によるハイパフォーマンスウェブアプリケーション開発実践
PPTX
はじめてのUniRx
PDF
「ずいぶんとダサいライティングを使っているのね」〜UniRxを用いた物理ベースライティング制御〜
PDF
Interactive UI with UniRx
PDF
History & Practices for UniRx UniRxの歴史、或いは開発(中)タイトルの用例と落とし穴の回避法
PDF
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
PDF
NextGen Server/Client Architecture - gRPC + Unity + C#
PPTX
RuntimeUnitTestToolkit for Unity
PDF
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
PDF
How to Make Own Framework built on OWIN
PDF
Metaprogramming Universe in C# - 実例に見るILからRoslynまでの活用例
PDF
ZeroFormatterに見るC#で最速のシリアライザを作成する100億の方法
PDF
async/await不要論
PDF
UniRx - Reactive Extensions for Unity(EN)
PPTX
ゲーム開発とMVC
PDF
Reactive Extensionsで非同期処理を簡単に
PDF
テスト駆動開発へようこそ
PPTX
ゲーム開発とデザインパターン
UniRx - Reactive Extensions for Unity
The History of Reactive Extensions
AWS + Windows(C#)で構築する.NET最先端技術によるハイパフォーマンスウェブアプリケーション開発実践
はじめてのUniRx
「ずいぶんとダサいライティングを使っているのね」〜UniRxを用いた物理ベースライティング制御〜
Interactive UI with UniRx
History & Practices for UniRx UniRxの歴史、或いは開発(中)タイトルの用例と落とし穴の回避法
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
NextGen Server/Client Architecture - gRPC + Unity + C#
RuntimeUnitTestToolkit for Unity
「黒騎士と白の魔王」gRPCによるHTTP/2 - API, Streamingの実践
How to Make Own Framework built on OWIN
Metaprogramming Universe in C# - 実例に見るILからRoslynまでの活用例
ZeroFormatterに見るC#で最速のシリアライザを作成する100億の方法
async/await不要論
UniRx - Reactive Extensions for Unity(EN)
ゲーム開発とMVC
Reactive Extensionsで非同期処理を簡単に
テスト駆動開発へようこそ
ゲーム開発とデザインパターン
Ad

Similar to Reactive Programming by UniRx for Asynchronous & Event Processing (20)

PPTX
Mini training - Reactive Extensions (Rx)
PDF
Reaktive Programmierung mit den Reactive Extensions (Rx)
PPTX
Reactive programming
PPTX
Reactive Extensions (Rx)
PPTX
Rx- Reactive Extensions for .NET
PPTX
Quick look in Reactive Extensions
PDF
Programming Reactive Extensions and LINQ 1st Edition Jesse Liberty
PDF
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
PDF
Programming Reactive Extensions and LINQ 1st Edition Jesse Liberty
PDF
Unite 2017 - Reactive Programming - Pieter Nijs
PDF
Programming Reactive Extensions and LINQ 1st Edition Jesse Liberty
PPTX
Creating a simple doodle (drawing) like application using silverlight and rea...
PDF
Reactive Extensions
PPTX
Rx workshop
PPTX
Reactive Extensions, Rx
PPTX
Reactive Extensions
PPTX
Reactive Extensions .NET
PDF
History & Practices for UniRx(EN)
PPTX
Reactive Extensions for .NET
PDF
A Quick Intro to ReactiveX
Mini training - Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)
Reactive programming
Reactive Extensions (Rx)
Rx- Reactive Extensions for .NET
Quick look in Reactive Extensions
Programming Reactive Extensions and LINQ 1st Edition Jesse Liberty
The Evolution of Async-Programming on .NET Platform (.Net China, C#)
Programming Reactive Extensions and LINQ 1st Edition Jesse Liberty
Unite 2017 - Reactive Programming - Pieter Nijs
Programming Reactive Extensions and LINQ 1st Edition Jesse Liberty
Creating a simple doodle (drawing) like application using silverlight and rea...
Reactive Extensions
Rx workshop
Reactive Extensions, Rx
Reactive Extensions
Reactive Extensions .NET
History & Practices for UniRx(EN)
Reactive Extensions for .NET
A Quick Intro to ReactiveX

More from Yoshifumi Kawai (20)

PDF
A quick tour of the Cysharp OSS
PDF
A Brief History of UniRx/UniTask, IUniTaskSource in Depth
PDF
Building the Game Server both API and Realtime via c#
PDF
Unityによるリアルタイム通信とMagicOnionによるC#大統一理論の実現
PDF
Unity C#と.NET Core(MagicOnion) C# そしてKotlinによるハーモニー
PDF
Implements OpenTelemetry Collector in DotNet
PDF
The Usage and Patterns of MagicOnion
PDF
True Cloud Native Batch Workflow for .NET with MicroBatchFramework
PDF
Memory Management of C# with Unity Native Collections
PDF
Deep Dive async/await in Unity with UniTask(UniRx.Async)
PDF
Binary Reading in C#
PPTX
RuntimeUnitTestToolkit for Unity(English)
PDF
How to make the Fastest C# Serializer, In the case of ZeroFormatter
PDF
ZeroFormatter/MagicOnion - Fastest C# Serializer/gRPC based C# RPC
PDF
What, Why, How Create OSS Libraries - 過去に制作した30のライブラリから見るC#コーディングテクニックと個人OSSの...
PDF
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
PDF
Photon Server Deep Dive - PhotonWireの実装から見つめるPhotonServerの基礎と応用
PPTX
Clash of Oni Online - VR Multiplay Sword Action
PDF
LINQPad with LINQ to BigQuery - Desktop Client for BigQuery
PDF
Introduction to NotifyPropertyChangedGenerator
A quick tour of the Cysharp OSS
A Brief History of UniRx/UniTask, IUniTaskSource in Depth
Building the Game Server both API and Realtime via c#
Unityによるリアルタイム通信とMagicOnionによるC#大統一理論の実現
Unity C#と.NET Core(MagicOnion) C# そしてKotlinによるハーモニー
Implements OpenTelemetry Collector in DotNet
The Usage and Patterns of MagicOnion
True Cloud Native Batch Workflow for .NET with MicroBatchFramework
Memory Management of C# with Unity Native Collections
Deep Dive async/await in Unity with UniTask(UniRx.Async)
Binary Reading in C#
RuntimeUnitTestToolkit for Unity(English)
How to make the Fastest C# Serializer, In the case of ZeroFormatter
ZeroFormatter/MagicOnion - Fastest C# Serializer/gRPC based C# RPC
What, Why, How Create OSS Libraries - 過去に制作した30のライブラリから見るC#コーディングテクニックと個人OSSの...
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
Photon Server Deep Dive - PhotonWireの実装から見つめるPhotonServerの基礎と応用
Clash of Oni Online - VR Multiplay Sword Action
LINQPad with LINQ to BigQuery - Desktop Client for BigQuery
Introduction to NotifyPropertyChangedGenerator

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Modernizing your data center with Dell and AMD
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Modernizing your data center with Dell and AMD
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
NewMind AI Monthly Chronicles - July 2025
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Review of recent advances in non-invasive hemoglobin estimation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

Reactive Programming by UniRx for Asynchronous & Event Processing