How do I access a variable from another class without using blueprints?
I'm creating a game in Unreal Engine 4 and I am only using C++, not the blueprints that are given. I want to be able to access a variable from my ProjectCharacter class in my projectHUD class, however, the only tutorials or help I can find is with blueprints. The syntax between C++ and UE4 seems to be a little off for accessing variables between classes. Could someone explain in code how I can do this?
Just to clarify, in the character class we give the player a certain thruster variable that controls the level of the thruster. I want to access this variable in my HUD class so I can display a bar that uses the thruster variable and a scale to display the level of the thruster on the screen. Please let me know if I need to clear up my question more.
asked Jan 20 '15 at 07:21 PM in C++ Programming
Several ways: Lets assume you have a class A and class B
To make a variable MyVar inside class A available in calss B, you have the following methods:
In your case I would suggest go with method 2 and write a getter function
Follow this question
Once you sign in you will be able to subscribe for any updates here