Hello. Emm.. I know this is quite... basic stuff but I just can't figure out how to make it work.
I have my HUD class, and my GameMode class. On the GameMode class I have a variable (int), which it's value will change eventually, and I want THAT variable to get printed/drawed on my HUD, the problem is that I can't figure out how to pass that variable.
I've included the .h file, creating object pointers and that.
asked Apr 10 '15 at 04:21 AM in C++ Programming
With c++ you can create a UBlueprintFunctionLibrary class, and make a global function to return that GameMode variable, you can use this blueprint function anywhere u want, this my code to get the GameModeType for my game then use it in HUD to display what gamemode i'm in
Declare in header:
UPDATE: Sorry i thought u want to use in blueprint, You can still use my code the part where you get the GameMode, you can use GetWorld() through HUD class GetWorld() or use GEngine->GetWorld() for anywhere, from GetWorld() u can get GameMode like above.
THANKS! I knew I needed to use the Cast Template, Im not very familiar with it. Your code is very useful BTW, It seems passing variables between classes is not an "easy task" as I thought it was.
answered Apr 10 '15 at 03:28 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here