I am trying to implement a main menu for my project

So what am I trying to do is implement a main menu for my game where on clicking the new game button would start the game… the steps I followed:

  1. Made an abstract class for UI (Base UI)
  2. Making child from it - Main Menu Widget
  3. On the Player Controller: its holding the ref to the Main Menu widget
  4. Also I am making a delegate to broadcast signals between the controller and the widget
  5. On the Game Mode: in the Post Login Function I am creating the widget and adding it to the viewport
  6. Also in there, I am adding a listener to listen to the buttons on the main menu widget.
  7. On Clicking the new game button, the UI would disappear and the game would start.

Now the problem:
It is successfully adding the UI to the viewport when the game starts but does not hide it