AddToViewport not working in game instance

HI guys,

I work on this problem for a week a cannot fixe it.
I try the Blueprint Multiplayer video tutorial. (https://docs.unrealengine.com/latest/INT/Videos/PLZlv_N0_O1gYqSlbGQVKsRg6fpxWndZqZ/abmzWUWxy1U/index.html)

At the end of the 5 tutorial (05 - Main Menu Setup), the menu is suppose to show but nothing happen.
I try many thing’s. I can display the menu from the level Bleuprint but not from the GameInfoInstance.
The ShowMainMenu event is fire in the GameInfoInstance and everything is exectuted to the end ( I added a PrintString at the end to see if everything is executed to the end , and it isd).

My conclusion is that the AddToViewport is not working in the GameInfoInstance because the GameInfoInstance dos not acces a valid Viewport???
Here is a screen shot of my

Level Blueprint


GameInfoInstance Event Graph

The top one is creating main menu in the bottom
Screenshots you are creating main menue with an e on it

So it’s the wrong class you have selected

Also why are you checking if something is valid before you even set it or have you already set the widget reference value somewhere else?

Thank’s you found the problem…:slight_smile:
In C++ it’s never happen to me…but in BluePrint it’s a little bit different…:slight_smile:

The resaon why IsValid is there is because we want to create the widget just one time. The ShowMain menu is tied to EventTick in the BluePrint Level, not to EventPlayBegin… well that’s the explanation I found to understand why the guy in the video tutorial has done that…:slight_smile:

No worries . Spelling mistakes in programming can be a nightmare always hard to spot and can cause so many bugs lol

As for the valid node it is correct my brain wasn’t working when I made that comment.

The first time it executes the node will return invalid and then create the widget but any time after that un till the widget is destroyed it will return valid and so skip the other code . Similar to a branch

Glad I could help