Widget Blueprint Error

I keep getting “Blueprint Runtime Error: “Accessed None trying to read property GameWidget”. Blueprint: GameCon Function: Execute Ubergraph Game Con Graph: EventGraph Node: Set InteractTextVis” Error and I don’t know why.

I have the Open Level creating the Widget and some blueprint that makes it visible or hidden, any ideas what i could be doing wrong?

This is the error I am getting.

This is some script that makes the Widget Visible.

This is the Open Level Blueprint

I thought **“Construct Object From Class” **would work but it only removes the errors, the Interaction text does not become visible.

Note: there is text in the text field.

Can you tell what is the scenario here? Is it absolutely necessary for the level blueprint to create the widget? Why not create it in the same object that needs to use is - the one with the Collision Event.

Also, do use the Create Widget node for this.

Making interactive NPC’s, pick up items and doors.

But I don’t feel like any of that information is going to help me modify widgets with blueprints in the aria of text, swap images or hide and show something.

Makes sense, create the widget in the actor that initiates the interaction - Pawn or the PlayerController - it makes it easy to access. I’d avoid using Level Blueprint for things that are not level specific.

This is going to sound dumb but
I just had everything working perfectly but as soon as I “Save All” I get Errors!

I’m going to try downgrading from 4.24.0 to 4.23.1 cause this is ridiculous I had everything working.
I have no idea what’s wrong.

This has absolutely nothing to do with it. It’s a very basic error - you’re trying to access an object through a variable that has nothing assigned to it.

where am i not assigning something???

Why dont you have a print out for both statement(after the creation of widget, after the get widgets of class) and see which comes first.

Now, this is confusing.

When I don’t “save all” the NPC script runs before the level script and everything works. When I “save all” the level script runs first and nothing works
but I need the level script to run first so I can add the game widget first so i can add the widget to the viewport otherwise it shouldn’t run

also, what is this?

I think I found the problem
I cant use “Event BeginPlay” on my NPC player, it starts too soon.

Shoot how am I going to find and tell multiple possible npc’s after creating a widget to run custom npcGetWidget event to get all widgets of class.
seriously I don’t know how to do that, and I can’t think of anything better.

Event dispatchers spring to mind :slight_smile: You can send out an event dispatch call to your game instance, then when you spawn your npc’s you bind to that event dispatcher so that when it is called, everything bound to it gets notified of it being triggered.