hello i have the following error “Access none” for Info Widget , the location of the error is second picture
Hey, it is unclear from the screenshots if you have actually CREATED the widgets. I don´t mean built and in the Content Browser, but you have to create it first, in order for it to be visible to the engine during runtime.
yes the widget is visible there are other things on it and they show
I believe he’s correct that you need to create it first because it’s not a persistent object and it will either return invalid or you’ll get accessed none. You gotta put it up in the view port just like his example above before trying to execute any logic casting to it…
First of all, I highly recommend you storing Interface related stuff into the HUD.
Are you testing as multiplayer by any chance? This and the usage of HUD handling inside your controller could result in your server running Interface related logic that will fail due to not having assigned a HUD a dedicated server.
Beside that I also recommend using a “is valid” function node to handle and filter errors with empty object references.
Sometimes they are just plainly caused by order or timing issues. (Like 0.2 seconds delay would fix things sometimes even if its kinda dirty but faster to prototype than checking initialization states.)
it is still the same issue
Taking a second look I believe its better to create your widget inside you game instance. Create a custom event and drag off and > create widget, select your widget class> get player controller, promote that to a variable> add to viewport. Call that function from wherever to bring up the widget and reference the variable from your game instance.
Thats much more reliable. I think doing this on the player controller will most always return invalid. I don’t remember why, I just stopped caring once I started doing this on the game instance without issues lol. Inversely you can remove the widget from the game instance on a separate custom event by simply pulling out the variable and connecting it to “Remove From Parent” node.
Sadly this might make some noticeable changes to your existing code, but it should work from your game instance.