Hello, I have a question I am hoping someone can help me with. I have a main HUD widget that when the character dies, I set its visibility to Collapsed till the character respawns. The problem is, I have an event dispatcher on my character that I call when the character dies, so I can hide widgets etc. But since the character is respawned, I need to rebind all events, and that can be tricky/not worth it. The best option I see right now is either not to use event dispatchers, or destroy the HUD and make a new when the character respawns. What would you suggest me?
When player dies are they separated from the pawn? You can use on unpossess to call a function to pc to hide the HUD and on possess show HUD
Sounds like this stuff should go on your PlayerController rather than a Character. Keep everything there and you don’t need to worry about redoing anything since the PC will never go away.
Thanks for the response guys! So I should dispatch events from the player controller huh? Should work alright. If no one has any better suggestion I will go with it. Thank you!
General rule I go by is closest association. Variables in a character should be directly related to the character like health, armor, stamina, stuff related to the player should be on the PC if local like HUD references etc and PS if somthing that is going to be replicated such as team and points.
Yeah that’s what I am doing, but I also have a variable called “Is Alive” and I use OnRep, and if local it hides the HUD, and triggers the On Death event. I guess I will just move the event dispatcher to the controller.
Keep us updated. If run into any snags have a video of the problem be happy to assist with what I know
Well since I didn’t get any other ideas, I made most dispatchers on the controller, works alright now. I really need to use event dispatchers more for my game, code looks a lot cleaner and I can find stuff a lot easier! Thanks people!