Why don't I have access to the HUD text variable? Can't change Text.

I’ve been trying all day, but I can’t get access to the text variable of my HUDs or I can’t change it.

I have created an Actor Component (BPC_PlayerStats) and added it to my character. In this Actor Component there are currently 2 functions, Damage Player and Heal Player.

I have added the UI widget to the VR hand (as a child) The text should be changed accordingly, depending on whether there is damage or healing. But I always get the message “Accessed None trying to read property As WB Hand Char Stats”, although I make a cast there or create a reference to it.

See pictures. All components are on the (VR) character. What am I doing wrong here? Many thanks for any information!

EDIT: Also in the function where i want to update the Text, i get the Accessd None Error.

It’s probably because the widget was not created yet, when you’re using GetWidget.
There’s multiple ways around it:

  • You could try using a really small delay before using GetWidget.
  • You could create the widget yourself using CreateWidget and then use SetWidget node to set the Widget in the Widget Component.
2 Likes

Thank you, Ive tried both suggestions, but doesn’t work. If i set the Text directly from the BP VR Character Blueprint, it’s working.

But if i want to set the Text from the Actor Component (BPC_PlayerStats) i get the accessed none error.

The UI is attached to the VR Hand. The PlayerStats Component is attached to the Parent (Character). So both are on the same Blueprint Class.

I make the reference to the ui in event begin play.

That’s really annoying.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.