UMG Widget visibility per level

Hi,

I apologize if this is same question over and over again, but I wasn’t able to find solution in available answers.

I’m trying to create ScoreUI widget that is only visible in specific levels. Reason I’m doing it is I want it to be hidden in my mainMenu level and visible in my gameLevel.

So I faced two problems:

  1. Where would you create your widget in this scenario? I thought if I will create instance in playerBP it will not be spawned in empty level, but empty level spawn all actors that I have and it creates scoreWidget as well. So I just created widget in my controllerBP and decided I will set visibility of the widget based on a level.
  2. When I’m trying to set visibility in level BP in eventBeginPlay my cast to controllerBP fails for some reason. Potentially it either not spawned yet , or controller is spawned but it hasn’t created instance of widget yet.

At first I thought my interface is not working but I setup actionButton and when I press it my interface triggers visibility change just fine.


What is the best practice approach in this case?

hi @Chimuru

I always get confused by some data management between game modes, player states, level blueprint and actors
even more when we are talking about multiplayer on server,
so here a quote and link
“Game State is not the best place to keep track of player-specific things like how many points one specific player has scored for the team in a Capture The Flag match
because that can be handled more cleanly by Player State.”