What? That works fine for me. Always displays the text when you're viewing from a specific player's POV as well.
What part of the UI blanks out? You realize that with 'Observer' selected in the player dropdown, there's no demigod-specific UI at all, right?
In fact, I just tested this with the original code (from the Enhanced UI in your last mod pack), and I'm not seeing any visual problems at all, and the bar displays just fine, and there are no script errors? If you're having a problem with it, I'm gonna need a log, and a very, very specific description of the problem, because it's not happening for me.
Edit: Ok, with the original code, I noticed that two little sections of the demigod portrait frame remain on screen if you switch from a player view to observer view. That's it. But the code I provided seems to fix that. Here's a version that makes sure that the entire barGroup display is hidden if no hero is present, just in case there are other issues that I'm not seeing:
- local OriginalOnHeroChange = OnHeroChange
- function OnHeroChange(unit)
- if hero and healthTxt and manaTxt then
- local OriginalCreate = Create
- function Create(parent)
- local OriginalHandleEvent = barGroup.dummy.HandleEvent
- function barGroup.dummy.HandleEvent(self, event)
- OriginalHandleEvent(self, event)
- return barGroup