[Slate] slate widget UI not displaying in viewport

I follow this tutorial, but I not sure where I need to add the code.

The tutorial say how to add the Widget to the Viewport, and give the code like this
"
GEngine->GameViewport->AddViewportWidgetContent(
SNew(MyWidgetPtr.ToSharedRef())
);

But I don’t know where I need to add.
please help me!
thanks!