Accessed None error I can't explain

Good evening,

I am receiving an error which I can’t explain, cause everything works as intended but yet I still get the error. I’ve got no clue what it is.

PS: All that love and kissing variables is cause iam making an Romeo & Juliet based game. :slight_smile:

Did you create your HUD widget at runtime?

“Accessed None” means something trying to access non set object varable (blue pin) in your case it Set nodes which means that HUD varable is not set. It might None at some point, but on 2nd call it might be set. thats why everything might work correctly, blueprints are very tolerant to runtime errors. You need to analyze when ball sets are called, by guess is it happens on start of the game where actors are placed to the world and may collide before HUD is set. Simplest brute force fix would be check if HUD is not None first calling SET nodes, which you can do with “Is Valid” node

Ensure your HUD is initialized before you need to call it. Best place for initialization is typically the Event Begin Play as nothing else (except the construction script) is called before the Begin Play meaning anything you initialize is done prior to calls to them.

If you are still having issues, run a simple ‘IsValid’ function on it like so:

And just in case you’re unsure what I mean by initialize your HUD, it should look something like this, in the same blueprint you have the Overlaps:

Hope this helps!

Thanks for explaining it in detail, really helped!

Thanks for the help! I did initialize my hud, the IsValid? node did the trick.