ParameterContainerのEnum型の変数にスクリプトからアクセスする方法

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

ParameterContainerのEnum型の変数にスクリプトからアクセスする方法

Post by kag »

お世話になっております。

Arbor: 3.3.2
Unity: 2018.2.14

ParameterConatinerにEnum型の変数を追加しました。
その変数へスクリプトからGet/Setする方法を教えて下さい。
#SetIntではIntタイプチェックが入っていて設定できませんでした。
よろしくお願いします。
User avatar
caitsithware
管理人
Posts: 493
Joined: 2015/08/17 12:41

Re: ParameterContainerのEnum型の変数にスクリプトからアクセスする方法

Post by caitsithware »

ParameterConatinerのEnum型についてですが、現在直接Get/Setするメソッドは用意しておりませんでした。

暫定的にGet/Setできる拡張クラスを作成しましたので、使用してみてください。

拡張パッケージ
Arbor3_ParameterContainerEnumAccess.unitypackage
(941 Bytes) Downloaded 328 times
このパッケージをダウンロードして、Arborが既に入っているプロジェクトにインポートしてください。

スクリプトでのアクセス例

Code: Select all

public enum WeaponType
{
    None,
    Knife,
    Gun,
};

WeaponType GetWeaponType()
{
    return parameterContainer.GetEnum<WeaponType>("WeaponType", WeaponType.None);
}

void SetWeaponType(WeaponType weaponType)
{
    parameterContainer.SetEnum<WeaponType>("WeaponType", weaponType);
}
細かなエラーチェックなどは行っていないため、パラメータのenum型とGet/Setする際のenum型が異なっている場合などに例外が発生するかと思いますのでその点はご注意ください。

正式には今後の更新で対応いたします。
それまで正式対応につきましてはお待ちください。

ご不便おかけして申し訳ございませんがよろしくお願いいたします。
kag
Posts: 35
Joined: 2017/05/19 08:28

Re: ParameterContainerのEnum型の変数にスクリプトからアクセスする方法

Post by kag »

ご対応ありがとうございます!
問題なく操作できました!
Post Reply