Skip to content

Animation and Particle Triggers ​

1. 概要 ​

Animation and Particle Trigger は、Animator と ParticleSystem 関連の Unity コールバックを Observable に変換する R3.Unity のファクトリメソッドです。GameObject と Component の両方に拡張メソッドが用意されています。

2. API 一覧 ​

API対象発行値
OnAnimatorIKAsObservable()GameObject / Componentint
OnAnimatorMoveAsObservable()GameObject / ComponentUnit
OnParticleCollisionAsObservable()GameObject / ComponentGameObject
OnParticleTriggerAsObservable()GameObject / ComponentUnit

3. サンプルコード ​

csharp
this.OnAnimatorMoveAsObservable()
    .Subscribe(_ => ApplyRootMotion())
    .AddTo(this);

this.OnParticleCollisionAsObservable()
    .Subscribe(other => Hit(other))
    .AddTo(this);