I am getting an “Accessed None Error Trying to read property Score” error on my widget. I’m trying to simply print the current score on the screen. The Update Score event is called from a Blueprint component that manages anything UI related. The error occurs when the UpdatePlayerScore event is called. When the event construct occurs at the beginning the error doesn’t appear even though it has the same nodes. What am I missing?
Might be a weird question, but are you sure the HUD is actually constructed? In other words, are you sure you’re calling InitializeHUD? (assuming that’s the only place where you create this widget)
Edit: To clarify, are you sure it’s constructed before the first call to UpdateScore?
Yes, it is being called from the Game Mode Blueprint on Begin Play. I moved it to being called from my Character Blueprint on Begin Play and it now works. Can I not call the InitializeHUD from the Game Mode blueprint?
You can call it from wherever you want, as long as it’s initialized before anyone starts using it.
In other words, I’m assuming your first UpdateScore
call came before your character’s BeginPlay
. Who and when is calling your UpdateScore
? (if you want to research this further)