Arbor EditorでVariableListをInputSlotにドロップする方法

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を確認の上、それでも使い方がわからない場合にご質問ください。欲しい機能の記載がドキュメントにない場合は機能が元から存在しない可能性が高いので要望フォーラムへ。
LKT

Arbor EditorでVariableListをInputSlotにドロップする方法

Post by LKT »

Arbor Editor上のパラメータタブにある要素のリストを
まるごとノードにparameterとしてドロップしたいです。

Image

Unity上でVariableを作成時に、Class単体はInputSlotなども定義されますが
そのClassのリストはVariableListだけあって、InputSlotなどは定義されていません。
ClassのリストのInputSlotの定義の仕方をご教授いただきたいです。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: Arbor EditorでVariableListをInputSlotにドロップする方法

Post by caitsithware »

VariableListの値をノードに受け渡すにはInputSlot<ILIst<要素の型>>を使用してください。

Unity2020以降の場合

Unity2020以降では、フィールドに直接ジェネリック型を使用できますので、InputSlot<T>をそのまま使用できます。

Code: Select all

class AccessFooDataVariableList : StateBehaviour
{
    [SerializeField]
    InputSlot<IList<FooData>> input = new InputSlot<IList<FooData>>();
    
    public override void OnStateBegin() 
    {
        IList<FooData> list = null;
        if (input.GetValue(ref list))
        {
            // listを使う
        }
    }
}
Unity2019以前の場合

Unity2019以前はフィールドに直接ジェネリック型を使用すると認識されないため、以下のように一度InputSlotを継承した型を用意してください。

Code: Select all

[System.Serializable]
public class InputSlotListFooData : InputSlot<IList<FooData>>
{
}

[AddComponentMenu("")]
public class AccessFooDataVariableList  : StateBehaviour
{
    [SerializeField]
    InputSlotListFooData input = new InputSlotListFooData();
    
    public override void OnStateBegin() 
    {
        IList<FooData> list = null;
        if (input.GetValue(ref list))
        {
            // listを使う
        }
    }
}
このようなStateBehaviorを作成すると以下のようにGet ParameterからInputに接続できます。
Unity_a50uvVWab1.png
Unity_a50uvVWab1.png (23.91 KiB) Viewed 1339 times


この辺りはVariable<T>にならってVariableスクリプト追加時に一緒に作成したほうが良かったかもしれません。
また、FlexibleFieldやParameterReferenceについてはユーザー定義スクリプト用途に使いやすい型がないのが問題ありそうですね。
どちらも合わせて対応できないか検討いたします。
LKT

Re: Arbor EditorでVariableListをInputSlotにドロップする方法

Post by LKT »

迅速なご対応ありがとうございました。
上記の通りに実装してみて、思う通りに動作してくれました。
おかげで直面する課題をクリアできました。
Post Reply