In my game currently, I have an enemy running around in my level. If you click on him, a character sheet of him pops up.
As you can see, the text block on the left is bound to GetText_0.
This is the event construct that’s supposed to get the variables from my character MobParent. The widget with the character sheet appears just fine when I click on my MobParent. But the values of the stats appear to be 0, when they’re set to be different numbers. I get this error after I play the game. Any help?
Blueprint Runtime Error: “Accessed None trying to read property MobParent”. Blueprint: CharacterSheet Function: Get Text 0 Graph: GetText_0 Node: Return Node
Well, how are you getting the reference to your character in your widget? You should make MobParent variable public and exposed on spawn. That way it will appear on your create widget node. Then just pass in the reference to your character.
You’re not setting the Mob Parent variable to anything. In the construction script you show, you’re setting Mob Parent equal to itself, which by default is absolutely nothing.
What you want to do is make Mob Parent “Instance Editable” and “Expose on Spawn” (both found in the details panel for the variable). This way when you make the widget, the variable will show up on the node. Then you can attach a “self” node to it so it gets set the actor that’s being clicked.
So I got it to display the correct number for health for the character sheet.
The character sheet takes up the whole screen so I wanted to use the AllStatsWidget. I’ve tried so many things with AllStatsWidget and nothing seems to work. Do I have to change something in my GetText to match it with the Allstatswidget?
I’ve tried this so AllStatsWidget creates itself.
AllStatsWidget contains the character sheet with the gettext. When I use create all stats widget instead of the create character sheet widget the value is still 0. Is there another place where I have to set mob parent?
Yes, that works for character sheet, but it doesn’t like when one widget is inside another. Im trying to have it not take up the whole screen so I’m using my AllStatsWidget, which for some reason has the values 0 with the same error. (See Below for my comment)
just added a canvas panel to the character sheet and did not use allstatswidget.