外部スクリプトからのParameterContainerの操作

Here is the forum to do the questions about how to use to Arbor developer.
Attention point:
  • We can not answer your questions about your project specific issues.
  • We can not answer your questions on Unity's specification issues.
  • Please check Arbor Documentation and ask a question if you still don't know how to use it. If the desired function is not described in the document, it is highly possible that the function does not exist from the beginning, so go to the request forum.

ここは、Arbor開発者へ使い方に関する質問を行うフォーラムです。
注意点:
  • ユーザー様のプロジェクトの仕様上の問題や設計に対する質問には答えられません。
  • Unityの仕様上の問題に対する質問には答えられません。
  • Arbor Documentationを確認の上、それでも使い方がわからない場合にご質問ください。欲しい機能の記載がドキュメントにない場合は機能が元から存在しない可能性が高いので要望フォーラムへ。

Forum rules
Here is the forum to do the questions about how to use to Arbor developer.
Attention point:
  • We can not answer your questions about your project specific issues.
  • We can not answer your questions on Unity's specification issues.
  • Please check Arbor Documentation and ask a question if you still don't know how to use it. If the desired function is not described in the document, it is highly possible that the function does not exist from the beginning, so go to the request forum.

ここは、Arbor開発者へ使い方に関する質問を行うフォーラムです。
注意点:
  • ユーザー様のプロジェクトの仕様上の問題や設計に対する質問には答えられません。
  • Unityの仕様上の問題に対する質問には答えられません。
  • Arbor Documentationを確認の上、それでも使い方がわからない場合にご質問ください。欲しい機能の記載がドキュメントにない場合は機能が元から存在しない可能性が高いので要望フォーラムへ。
hassy
Posts: 6
Joined: 2016/05/12 22:58

外部スクリプトからのParameterContainerの操作

Post by hassy »

既存のライブラリと連携させるために、外部からParameterContainerの値を操作することは可能でしょうか。

例えば、MIDI入力を取得する既存のライブラリがあったとして、取得した値をParameterContainerに渡して、FSMがParameterContainerの値を参照しつつステートをかえる、ようなイメージです。外部のスクリプトから、SendMessage / UnityEvent / ExecuteEventsなどでParameterContainerとやり取りするような事例がどこかにあると助かります(やり取りできるなら他の手法でもかまいません)。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: 外部スクリプトからのParameterContainerの操作

Post by caitsithware »

ParameterContainerクラスには直接パラメータの編集が行えるようなメソッドを用意してありますので、スクリプトからそれらを使用して値を渡すことができます。
ParameterContainerクラスリファレンス
SetIntやSetFloatなどでは名前と値を指定することで設定できます。
それ以外の型であれば、GetParam()でParameterを取得し、値を設定後ParameterのOnChanged()を呼び出すことで反映されるようになります。
Parameterクラスリファレンス

SendMessageなどに関しては指定できるメソッドの形式に制限があるため使用できません。
既存ライブラリがそれらイベント機能に対応していたとしても、既存ライブラリとArbor間でデータをやり取りするためのスクリプトは別途必要になります。

また、単に既存ライブラリとArborの橋渡しとしてParameterContainerを使用するとお考えの場合は、ParameterContainerを介さず既存ライブラリ用のStateBehaviourを作成し、
ArborFSM内で直接既存ライブラリから得た値を判定する、という流れもよいかと思います。
hassy
Posts: 6
Joined: 2016/05/12 22:58

Re: 外部スクリプトからのParameterContainerの操作

Post by hassy »

ありがとうございます、無事コンテナの値の操作ができるようになりました。
アドバイス頂きました専用のStateBehaviourを作成する件も並行して検討します。
Post Reply