Accesed none error

Whenever you receive that error, try adding the “Isvalid” macro to prevent it from continuing an execution sequence with a blank value. It removes the error, but will not necessarily solve the problem.

The error occurs because you are trying to perform some sort of function that relies on a variable, but the variable isn’t set when you run your function so it returns that error to let you know you haven’t set a value to the variable. You can also solve this by considering the sequence of events.

For example, if you attempt to do something with a widget, but you haven’t yet added that widget to the viewport or set the widget reference before you start your function, it will return with trying to read none. If you change the sequence so that you set the widget reference before running the functionality, it will work.

So I was following this tutorial for setting up character movement and I encountered the error below. I checked ten times and I am sure I did everything the same as him. Can somebody help me? If you need more screenshots just ask. Here is the link of the video: [Unreal Engine 4 - Sprinting and Stamina Bar (Part 1)
][1]

Can you show the screenshot of where you add the widget to the viewport - click the underlined Add to Viewport.

Here you go.

Weird, can you try right clicking that create widget node and refresh, then compile. Is the widget compiled successfully?

Also hooking up Get Player Controller to Owning Player might help.

I refreshed and added the player controller but nothing changed. Something which I forgot to mention before was that the widget does appear on screen but it just doesn’t work. Out of curiosity, is the blueprint from the tutorial supposed to work or is it outdated?

Something which I forgot to mention
before was that the widget does appear
on screen but it just doesn’t work

You’re experiencing something strange. Can you show the widget you’re creating? Is the widget blueprint compiled with no errors?

Nah scratch that, you’ve already attached it. I would restart the editor at this point.

I can’t think of anything that could generate this error based on what you’ve got here. Especially that the widget is added to the screen just fine…

One thing you could try doing (if restarting does not solve it), right click the return value (create widget node) and promote to variable.

Welp, things just got weirder. I looked at the tutorial and decided to get rid of the one thing which I did different, the border and now it works with the only problem being that I am STILL getting the error message. Unreal engine is hard…

In my experience of adding a widget to the viewport, I had to add a small delay node before actually calling the add to viewport node. I think this is because it tries to add the widget to the viewport the exact tick the character comes into play, but at that time the character isnt fully initialized and isn’t ready to be refereneced by other lines of code.

TL:DR: Add a .5 second delay before calling the add to viewport node.

I went ahead and made a new project and migrated all the assets and it started working. I have no idea why this happened but I that’s how you solve it