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?
asked May 19 '15 at 06:52 AM in C++ Programming
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
answered May 19 '15 at 04:18 PM
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!
answered May 19 '15 at 12:49 PM
Also you can create a Blueprint like in https://wiki.unrealengine.com/Blueprint_Function_Library,_Create_Your_Own_to_Share_With_Others
These are static function you can then call you other statics from that.
answered May 19 '15 at 04:01 PM
SND R Keene
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.
answered May 21 '15 at 04:43 AM
SND R Keene
Follow this question
Once you sign in you will be able to subscribe for any updates here