In UE5, I added a widget component to an NPC actor blueprint I have. I set the widget component’s widget class to be Dialogue_BP. In another component attached to my NPC, I am able to successfully get a reference to the widget componenet (get owner->get component by class). However, when I try the get widget node or get user widget object, it returns a widget of type unknown (when I want to get a reference to the widget class dialogue_bp). Am I missing something for how to access the Widget Class? I have tried changing my widget class to WidgetMenu, and other Widgets, and the get widget node always returns unknown. I cant find anything online about why this is happening and was wondering if anyone had any advice??
- for an actor with a widget comp and some other component:
- this would return the widget:
What are you doing differently?
There’s another way of setting up comms for this (without using an interface); not sure if relevant but here it goes:
- in the component:
- in the widget:
- the actor that owns both serves as glue:
This would result in us clicking the button and the someComp
getting the data from the widget via that Custom Event.
This requires no lookup, and binding can be removed at runtime if needed.
Currently I am doing that get owner → get component by class → get user widget object → cast to Dialogue_BP. Through breakpoints I can tell that I am successfully get my component class, but get user widget object is always returning known no matter which widget class I have assigned.
Hard to tell what could be going on without more details; what I had posted works OK.
- when, where and how are you doing all this?
- how is the class on the widget comp set?
- could you post a code snippet that throws the error?
I guess new members can only put one embedded media item in a post so I will be breaking this up. My Dialogue Widget Component:
This script is inside of another component attached to my Catbug Final Skeleton actor. The red circles output always says Return Value Unknown [Class Unknown]. I’ve ask tried using Get User Widget Object instead of Get Widget, and it still returns Unknown [Class Unknown]
Could you try with this particular node:
Instead of Get Widget
.
I did try this and it was also unknown. I actually ended up fixing the issue. I have having an error with physics that I didn’t think would effect the Dialogue, but I guess it did and was preventing other components from working.
Cool, thanks for reporting back!