always necessary to add a widget to the viewport?

hi

is it always necessary to add a widget to the viewport?
when don’ t you need to add a widget to the viewport?

thanks

No but you need to keep it in a variable or continuously used it in some way to prevent it from being garbage collected(which occur each 1min).

No, only if you want it in the viewport.

  • when its lifecycle is managed by a Widget Component
  • when you want to have a widget in the memory, ready-ish, but are not really ready to show it yet
  • when you add it to another container that is already showing
  • when you don’t want to pay the cost of laying it out just yet
  • when you’ve got layout operations pending and it makes no sense to add it now
  • when you want to fire Init but are not ready to trigger Construct yet
  • when you don’t want its Tick to tick
  • when you want to have the widget bound to delegates but it does not need showing
  • when you instantiate Tooltips
  • when you create a visual for the Drag & Drop OP
  • probably a handful of other scenarios

  • oh yeah, as in the previous post - when you DO want it Garbage Collected