How can I display a variable from an instance of a class blueprint using a UMG widget?
I'm trying to do something similar to this tutorial: https://docs.unrealengine.com/latest/INT/Engine/UMG/QuickStart/4/index.html
However, instead of displaying variables stored on my character, I'm trying to use a variable from a different object. I've created a class blueprint called TimePylonBP and placed it in my level. TimePylonBP basically speeds up and slows down global time based on the player's distance from it. It stores this info in a float called CurrentTimeScale.
I want to display CurrentTimeScale as a percentage or progress bar or something, so that you can easily see how fast time is going. I've followed the tutorial I linked above, creating a widget, and binding a progress bar to the function GetTimePercent:
But CurrentTimeScale doesn't seem to be updating at all. It should be non-zero, because I use it to calculate the time dilation which works in gameplay, and yet:
The grey bar at the top is my progress bar, so the actual widget is displaying properly. And GetTimePercent is getting called (that's where the debug 0s are coming from every other line).
My current guess is that the variable PylonRef refers to the generic (???) class blueprint TimePylonBP and not the specific instance that I have actually placed in my level. So how do I go about getting a reference to that specific actor?
In another blueprint tutorial, I remember having to physically pick the instance from a dropdown (click on the object in the viewport > details panel > select instance), but this was for communication between two object blueprints or class blueprints or whatever. My widget blueprint doesn't exist in the world, so I don't think I can do the same thing.
What am I missing here?
Your assumption seems correct. Wherever you add your NewWidget to the viewport you may want to set it's PylonRef immediately after that.
answered Nov 16 '14 at 05:38 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here