Download

Timesystem - Communication between Class Blueprints

Hey folks!

I have got a general question about Class Blueprints, and I might need your advice on how to do something.

So, I have got a 3 Blueprints:

  • Time, Class Blueprint (Actor) - (placed in the level)
  • Door, Class Blueprint (Actor) - (placed in the level)
  • DefaultHUD, HUD

The Time Blueprint is a piece of code that has a delay of one second, executes TickMinute and does all kinds of calulations to make a 24-hour clock system. Door is a Blueprint that simply rotates a mesh when a player begins overlapping a Sphere (both in Components). Last but not least the DefaultHUD, it should show the current time.

The things I want to accomplish is: (1) that the HUD executes the getTimeAsString from Time and displays this value, and (2) that Door executes the getTime from Time and calculates if the door can be opened at this time. I know how to calcuate it when I have the data, so no worries about that (:

My questions is (1) how to make these blueprint communicate with each other in a nice way, so what is common practice? And (2) if the Time Blueprint should be an Actor (and placed in the Level) or should be placed elsewhere (Level Blueprint/GameMode etc.)

Thank you for any help you can provide!

https://forums.unrealengine.com/images/icons/icon14.png

In the meantime I’ve made a Blueprint Function Library, where the function gets all the Actors of class Time, select the first one (there should be only one) and call its GetTimeAsString method. I don’t think this is the best solution since you still have to place the Time Actor in the level.

Any other thoughts?