From Code To Blueprints


One of my tasks this week was to hook up the wave system to the UI. Up until now the countdown to the wave as well as the current wave number, has all been showing up through debug code. Once my teammate added the HUD widget to represent the wave information, it was my job to make sure it was updating properly. I thought this would be quick and easy seeing as I already had those variables in the wave system but once I looked over how the HUD was set up, I realized that it was done in blueprints and I had created my wave system in C++. This meant that the C++ class for the player had no reference to the HUD widget. One possible solution could be to create a C++ class for the HUD and reparent the blueprint but that would require me to make a decent number of changes in a part of the project that I was not in charge of, not to mention redoing existing work by moving it over to blueprint.

After thinking it over I came up with a solution that would allow me to keep everything how it was and not redo any functionality. I realized that by creating a blueprint implementable function in the player, I could bind that function to a delegate in code but communicate with the HUD in blueprints. Instead of binding to the HUD widget functions directly I could access that functionality through this new function. This allowed me to not immediately start changing or moving work that my teammate had done the second it was passed to me, while still getting the functionality to work with what I had built.





Leave a comment

Log in with itch.io to leave a comment.