How can I reference an actor from the scene, inside a custom HUD?
So I have an Actor Blueprint that contains most of the logic of my game. Its called MainGame.
I have a button on the hud and I want to call a method from MainGame.
I made a variable in my hud and exposed it & made it editable but I can't set that variable with my MainGame instance.
How can I fix this?
P.S. Somebody suggested I put all that game logic into a custom GameState since its always one instance and its easy to get GameState but I am not sure that's the intended use of GameState.
asked Jul 06 '14 at 11:26 PM in Blueprint Scripting
I would put your MainGame actor reference in your player controller maybe. This way you can have the player controller spawn it if it doesn't exist or do a quick find by class and store a reference to it if it does. This way your HUD just has to get the player controller, cast it to the proper type, then grab a reference from there.
answered Jul 07 '14 at 12:09 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here