I’m attempting to use the UMG Widget to make a HUD display that shows the players current max walk speed in hopes to help debug certain things later on.
Unfortunately I have run into issues with multiple setups of this and have been trying different things, it seems a lot of nodes I’ve been using don’t play nicely with each other and I simply can’t find the right ones to use in this situation.
The bottom half is what is currently connected, it gives no errors, but it is not outputting any text or numbers, possibly because it is not connected to the character itself?
Above that is some of the component’s I’ve been trying to put together to connect the character in, but I get this error which suggests to me that they’re not the components I will need for this.
Here I have some nodes in the first person character event graph. The reason I did it there is because it is really easy to get access to the character movement component.
I drag a reference in, then drag off of its pin to get max speed. I used event tick and print text in this quickie example, but if you only wanted the speed upon play start you could use begin play instead, or you could add a delay node so you only get the result once every few seconds, etc.
Linking things to UMG is pretty tricky as far as I understand because you are trying to set variables on something that does not exist in the editor, you create an instance once the game starts. I do this by "initializing the interface like this:
Though I’m no coder, so i may be doing something strange.
In any case, notice how I got a reference to the first person character and set it to a variable I made in the interface? That allows me to set text in UMG based on any variable in the first person character (since a character movement component is included in that character i can access them too)