Help with efficiently sharing time integer between blueprints and widgets.

In my Game State Base I generate and set an integer that represents my games time of day in seconds.

It works great, but I want to be able to use it for several other things such as changing instanced NPC states and serving as the basis for a user widget that displays the game time.

I’m trying to avoid clogging up my game state base with every function and event that I want to do. I have some experience with casting and using blueprint interfaces. Using them is still a struggle for me and I would like my hard references to be done correctly and efficiently.

Can anyone offer me some insights on an efficient flow for this variable? Examples with blueprint code would be greatly appreciated.

1 Like

If you have the seconds variable in your GSB, you can just access it in your widget with

image

Technically, it’s not good form, though.

A better approach, is using an interface, like

Implement it in your GSB

Then, in the widget, you can use

image

1 Like

Thank you so much for clearing this up. The blueprint examples make your answer extremely easy to understand.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.