I want to create a number of stats that continually update in the viewport, basically identical to the Show FPS toggle. Except I want to link it to say an objects Y rotation or really any data field in the Details pane.
I went down a rabbit hole of C++ game dev videos that seem really overly complex for this use case. I’d love to know if there was an easier way to approach this before I spend hours delving into the depths.
Hi @CatalystFIre
If I understand you correctly this is no different then regular HUD/Widget that would display player stats. You just need to feed the right information into the right widget component.
Can you provide an example of what exactly you need to display/track?
Yeah sure, so the use case is that I have a simulation of an object and I want to continually display the rotation data to screen as the simulation plays. So visually everybody can see what the max and minimum rotation of that object is in realtime.
I’ve seen a lot of tutorials that have logic such as, Press F key to print to screen current actor location.
I want the data to constantly update the UI until the game is stopped.
We put a such a function generically named “DrawDebugStats()” in our Base HUD CPP class.
Basically, if a variable is toggled then it draws debug stats on screen using the built in AHUD::DrawText() functions. The DrawDebugStats() function gets any data from accessors in whatever classes are needed.
About as simple as you can get. No UMG involved. Just a pure Cpp function called in HUD::Tick() that draws some debug text.
For anyone interested, inside the actor’s BP who’s details I wanted to show in the hud I added to Cast that to my created HUD and updated it using Event Tick so it continually updated: