I could be wrong, but I don’t think GetOwningPlayerPawn() works inside a widget inside a widget component. There’s no need to do this anyhow. Just use WidgetComponent->GetUserWidgetObject() and cast it to your widget class. You can do this on BeginPlay. At least, that’s what I’m doing and it works fine.
Then you have an IOLHpInterface. Is that an interface that can be used in Blueprints? If so, you’re not supposed to call methods directly unless your interface has this UINTERFACE tag:
meta = (CannotImplementInterfaceInBlueprint)
Otherwise, you need to use something like this:
TScriptInterface<IOLHpInterface> CharacterInterface(ParentActor);
CharacterInterface->Execute_SettingHpBar(CharacterInterface->_getUObject(), this);
OR
IOLHpInterface::Execute_SettingHpBar(ParentActor, this);
As for the logs, it wasn’t clear from your description what is working and what isn’t. You said this:
But immediately after, you say this:
Which is it? And what logs work and what logs don’t work?
Anyhow, from what I’m seeing, if GetOwningPlayerPawn() does work, it’ll always return the same value so you’re just setting the widget on the player actor. The NPC’s widget pointer is always null. I would be very surprised if the NPC’s HpBarWidget member is not null.