i have an error with the reference

I have two 3D actors “actor A,” which has the blueprint “interface A” in its widget, and “Actor B,” which has the blueprint “interface B” in its widget. Each blueprint has a textbox.

“Interface B” is located within another interface called “interface B sub 1,” which in turn is located within another interface called “interface B sub 1.1”

I need the textbox of “interface B sub 1.1” to, when a button is pressed, copy the text from the textbox of “interface A”

But when I connect the blueprints, it compiles but does not work. I am using the methods “get all actor of class” and “get actor of class.”

I am using Unreal Engine 5.2.1.

can you please provide an example of your code? the likely reason tho is you aren’t casting to the correct object type

Problem is that widgets are not actors (they do not inherit from Actor class).

So you need some master widget or actor they can always find. I use either hud blueprint or game mode (that depends on what my widget is communicating with). If its widget-widget or should be local to one player i use HUD (or player controller/pawn). If its communication with actor in level i use game mode. It can be done both ways for actors and widgets, i just prefer to separate this way.

So make dispatcher in HUD.
Widget that should receive information hooks to that dispatcher
Widget that sends information triggers dispatcher
This way you do not need to worry about finding other widget in whole stack of widgets.

I also did some type of communication system (was really tired of traversing parent of parent of parent of widget up and down) it was made for HUD display.

what i did:

  • it was only for displaying information on screen, no input from widgets
  • made enumerator that said who should read message
  • every widget had that who enum variable and hooked to dispatcher in HUD bp.
  • if message from dispatcher had same enum value as widget it read it and used to display
  • messages were always sent as TEXT, because really handy FormatText node
  • in blueprint interface of widget i implemented function that changed message into whatever widget needed to display be it color, int32, float etc.

Then everything that wanted update on HUD triggered that dispatcher. No more going up and down that silly widget chain. Widgets could be independent from where they placed etc.

However there is single problem with all this, if you use Event Construct in widgets you cannot be guaranted that Game mode exists (or rather is initialised and has proper valus). To battle this (instead famous 0.2 delay) check if pointer to HUD or game mode is valid if so hook to dispatcher, if not do it again on begin play or any other event that happens after construct. This way you see values in editor and then in gmae, without bad reference flood of errors.

Sorry

ahhh…
well for now id recommend you do something like this. see if this helps at all

besides all that, id recommend using variables instead of pulling from lines like that (the blue object refernces). idk why most new unreal engine users do that, but its not good programming practice, espeically in situations like this.
generally, it can will cause lots of performance issues. in this specific instance, the event construct may be asking you to get a reference that doesn’t exist yet, but will when you press the button.
the code wont be run again tho, so whatever the last state of that cast is going to be what you pulled.

I tried to follow the steps you recommended (as far as I understood) but at the end it throws the following error.

PIE: Error: Blueprint Runtime Error: “Accessed None trying to read property Target”. Node: Set TEXTOCONT Graph: EventGraph Function: Execute Ubergraph VRPawn Blueprint: VRPawn


Thank you, I will try to fix it. How can I generate the reference beforehand?

this likely means that your editable text box isnt valid to begin with, likely because its nit being created or the object reference “editable text box” is pointing to nothing in memory

I found the fault. The code was fine, but everything was being created all at once, so there wasn’t enough time to create the references. It was fixed by adding a “delay” before the actions.
Thank you very much for your patience <3<3<3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.