Blueprint communication with static class

I’m trying to make an in-game clock with its own time-passing speed, ability to fast forward, etc. and all animations and day/night cycles and the like would adhere to it. Since this is a one-off system, I decided to make it a static function library.

I want to be able to grab its properties (ex. current time) and display it on the HUD. However, nothing shows up when I attempt to search for my supposedly exposed variables. How should this be properly written?

Current .h:

class UGClock : public UObject

	static void Setup();
	static void FastForward();

	static float CurrentTime;


Hello, sgp

Please note that static properties are not available in UE4, but there are Game Mode and Game State classes that are more suitable for global parameters of your game.

However, there is a possibility of creating your own static libraries. If you like to learn more about this, please go here:

Hope this helped!

Good luck!

Static functions work, lack of static properties support is lack of UE4, but C++ is fully functional, so you can make get and set functions for those static variables. Also note as static properties don’t in reflection system, garbage collection won’t work on, so you need to watch out what you do with them

Also you can create a Blueprint like in A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

These are static function you can then call you other statics from that.

Thanks, the GameState class seems to be what I’m looking for, but I’m lost on how to actually work with it and can’t find anything to help me. Are there any tutorials on this?

To use the GameState, tell Unreal to make a new C++ class in the project. Make GameState be the parent class.

Now you have a C++ ( .h and .cpp ) of your new GameState, like MyGameState.cpp and such.

Then in your project set the new class as the game state instead of the default game state.

Make usre to generate the Visual Studio project, compile etc.

Now in MyGameState.h you can add new functions to call. They are not static but can call static calls.
You can also access them from blueprints if they have the annotations above the function calls.