コンポーネントのウィジェットにアクセスして変数で参照する方法について

このような感じで、BPに適当なコンポーネントのメッシュとコンポーネントのウィジェットを設定しています。
ウィジェットはウィジェットクラスに「TestWidget」というテキストがあるだけのウィジェットを指定します。

このBPのイベントグラフで「TestWidget」を変数に格納し、アクセスしたいのですが、以下のようにメッセージが出て実現てきません。

コンポーネントのウィジェットをグラフに配置、変数は「TestWidget」型の変数を用意し、これにセットする。しかし、コンポーネントのウィジェットはあくまでウィジェットであり、「TestWidget」ではないためSet出来ないのかと思います。

そのため、コンポーネントのウィジェットから「TestWidget」をgetしたり、変換するような処理が必要か、TestWidgetの変数の型が間違っている(他に表示されるクラス参照などを使う)のかと思ったのですが、前者はそのような処理が見つからず、後者は型を変えても同じメッセージが表示されるだけでした。

どうすればこの問題を解決できるでしょうか。

正しいタイプの変数を作成しようとしないでください。ここを右クリックして、[パラメーターに変換] を選択してください。

Thank you.
I performed this operation, but it did not solve the problem because the variable created by this method is not “TestWidget” but “WidgetComponent”.

1 Like

Ok, but that’s why you can’t make the assignment there :slight_smile:

Sorry, I don’t understand what you are trying to say (this must be the nature of translation tools)
It would be very helpful if you could tell me how to solve this problem.
Sorry, I don’t understand what you are trying to say (this must be the nature of translation tools)
It would be very helpful if you could tell me how to solve this problem.

Make the variable of type ‘widget component’.

But when you come to talk to your widget, cast to ‘test widget’.

Sorry. As far as I can tell, there are two ways to do Cast. Which is the one you are referring to?

I would like to be able to access the UI of the widget and the bound variables.

Like this?

Thank you, you solved a tough problem!

1 Like