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:
- 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.
- 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?