Why does this not work?

I’ve been using blueprints for a little bit, I’m not that new, but I’m also not that experienced; however, more recently I’ve been constantly plagued by this issue: “Blueprint Runtime Error: Accessed None Trying to Read Property.” Now I can understand why some things wouldn’t work because of this, but I can’t even call a custom event from a different blueprint that literally only prints text. I would be most appreciated if someone could tell me as to why this is not working, and what I need to do to fix it.

Here are screenshots of a test project I made to showcase this issue:

http://prntscr.com/isy826 This is the blueprint containing the custom event.
http://prntscr.com/isy8jd This is the blueprint calling the custom event.
http://prntscr.com/isy8vw This is the error I keep getting.

Thanks for any future answers.

Hi, in the 2nd screenshot where the Ref1 is, try to add at Event Construct this:

create widget > widget1 > promote to variable Ref1. then when the button is pressed, add to viewport (target ref1), then call the custom event thats in it.

Thank you, that does work. But why exactly does that work instead of how I had it before? Isn’t it still just referencing that blueprint?

I had created the widget in the level blueprint, just forgot/didn’t put a screenshot of it. Yeah I guess I didn’t feed anything into the variable, I just don’t seem to understand why the reference would need a value since I’m just calling an event from it.

You did set the reference, but you didn’t “feed” anything into the variable, plus the widget never got created and shown on screen, so it tried to call an event that doesn’t exist yet.

It’s the same for actors, you need to “Cast to” then promote to a variable, then it will work. The reference in the variable is more like a “what it expects” kind of thing. To make it easier to filter out things, for example if you put a weapon base class there, it will show you only it and its child classes when you call the variable from somewhere, but to make it work, you need to set an actual thing what it is at begin play.

No problem :slight_smile:

Ahhh it makes a lot more sense now, thank you very much for your answers :slight_smile: