UMG Access None Error

I have a simple text block that I want to display a variable from the character blueprint. It displays the variable just fine but will throw an access none error. Disconnecting the text output will cause it to stop, but obviously not display the text anymore.

use an IsValid node on the MyChar variable before getting its member variables, that will stop the Access None errors.

object references need to be set to an object, or else its Null. when you spawn this UMG widget, you should give it a reference to your character, so you can set its local MyChar variable to equal your character actor, or you could just pass in a string and use that to set its text block.

so if you spawn this UMG widget from your HUD, right after spawning it, before adding it to viewport, you would getOwningPawn, cast to YourCharacter actor, then use that to set the Widgets MyChar variable.

That worked, but is there any reason why it would always be invalid?

That isn’t what I did in the event construct?

Or, you could include a cast to Mycharacter here, and get the text variable from there directly.

It could be that the character isn’t spawned at the time you create the widget. In your Binding, you could directly get the Character, check if it is valid and continue. But make sure that every exec pin (even the one of “CastFailed” reach the return node somehow!