Download

"Accessed none... " for Widget

Dear experts,

I have a widget the user can toggle on and off. It is off by default. Every time I toggle it on it works but I get this error:
PIE: Error: Blueprint Runtime Error: “Accessed None trying to read property InventoryWidget”. Blueprint: BP_MyPlayerController…

I looked at a few posts, for example this one
https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1364265-how-to-check-if-a-widget-is-visible

to see how I can check, properly if the widget is visible or not. Now I simplified my blueprint to only check if the widget is visible and I still get this error immediately
PIE: Error: Blueprint Runtime Error: “Accessed None trying to read property InventoryWidget”. Blueprint: BP_MyPlayerController…

Why do I get this error. How do I properly set/check my “Inventory Widget”?

Thank you,
Peter

I am not the blue print expert but now I think I have a workaround for this issue. Instead of setting the “Inventory Widget” variable I create the widget with Begin Play without adding it to the viewport:

I don’t get the “Access - error” anymore. Seems like this is more stable than setting the Widget variable.

Best regards, Peter

Peter, your issue in the first code example is that the value of the InventoryWidget variable is nullptr. You need to create a widget and then set the InventoryWidget variable to be equal to that widget.