I am trying to create a wall that demands the player to pay artefacts to enter. I create a widget, then a text. Set up a variable on my wall called artefact price I find that arteface price in my UI widget but it does not display in the view port.
I just want to have a wall that has a variable I can display on it. I want to change the variable per instance so one wall says “10” another says “100”
In your image under In the wall BP it says get widget, I dont see that. Maybe im getting this all wrong. I create the text variable on the widget right?
I got it to work by using the “Get user widget object” that did the trick! I have done 2 major c++ classes and a blueprint class on UDEMY and the moment I sat down and I am toying with this on my own, I am ABSOLUTELY lost.
Even with help I think getting my hands in the dirt and not following a recipe is the way to go to learn this. Else it just doesnt stick.
I cant thank you enough, I will keep spamming the forum, this place is fantastic.
“Why?What?Where?When?”:
With EventBeginPlay we create our references to the widget Paywall_W (PaywallRef) and to the character (CharacterRef). With these references we have access to variables (etc.) within these. Then, from the PaywallRef we get the CostText and set it to a number (like 123) with a variable of type text called Cost (InstanceEditable). So there is a text/cost we can change. After that we bind 2 events to the button from our widget. Drag the pin from PaywallRef, get CostButton, drag the pin from CostButton and add BindEventOnHovered and BindEventOnClicked. To add CreateEvent drag the red pin Event and add CreateEvent from EventDispatchers. To be able to choose OnHover() or Pay() you have to create those as a CustomEvent. OnHover displays a text on the button and Pay subtracts the Cost (visible on the wall) from our Coins. The Coins variable is of type integer and has to be added in ThirdPersonCharacter.
To be able to interact with the widget on the wall there also has to be a WidgetInteractionComponent in the ThirdPersonCharacter. The WidgetInteractionComponent has a function called PointerKey. When this Key is pressed (for a button you want LeftMouseButton) you click the button. You can enable ShowDebug to see a line representing your character “aim”.