Widget is not creating

Sorry to bother you, but my widget doesn’t work after this piece of code. When I tried to put it in BeginPlay, everything worked. I don’t know why it doesn’t work, I watched a bunch of videos, but can’t found the answer


thank you in advance

When I tried to put it in BeginPlay, everything worked.

So what changed? How is this triggered now? Does it show up but does not play the animation? If you place a print string after Add to Viewport, does it print?

If i put it after the SetHealth, the widget is not created, that is, if put a print string BEFORE IsValid, it will work, but if after - no. That is, if put it after the SetHealth, it is created but does not exist (so to speak). If put it in BeginPlay, everything works fine, the animation is displayed normally and everything works as planned.

After a new analysis, I realized that the problem was in the online system (unfortunately, I did not consider it a necessary part of the code, so I did not photograph it). The main problem was that all this code was running on the server, so all I had to do was make an RPС(Owning client) and take addres to enemy in RPC function.

In any case, thank you to “Everyone” for responding to my question



1 Like