InputActionのperformed
、started
、canceled
コールバックはマルチキャストっぽいインターフェースになっており、+
演算子でAction
追加、-
演算子で削除を行うようになっている。
inputAction.performed += _ => {};
このままでは使いづらいので作ったのがこの拡張メソッド。IDisposable
が返ってくるので、あとはUniRxに任せてAddTo
で解放するなりなんなり。
inputAction
.SubscribePerform(_ => { })
.AddTo(this)
コード
github.com