UCanvasPanel::AddChildToCanvas is very slow ?

Hello,

I noticed that UCanvasPanel::AddChildToCanvas is super slow.

I takes around 3-4 seconds to add ~30 widgets in a for loop.

Should i be using another mechanism to automatically populate a canvas panel at runtime ?

It gives me two problems:

  • i repopulate the canvas by clicking buttons, so it’s not responsive at all
  • when clients connect to the server, it seems that the UI is entirely rebuild, so Initialize(), preconstruct() and construct() are called at each client connection and i get a few seconds freeze when a client comes in.

I tried to put the populating for loop in a separate thread (FRunnable) but it doesn’t solve the problem.

I also tried to use timers. It’s ok when i call one AddChildToCanvas every .1 s, but given that i can have a lot of widgets (> 100), it takes forever to populate the canvas and leads to other problems.

Is there a fast way to populate a CanvasPanel at runtime ?

Thanks

Cedric

I couldn’t solve this properly so i used the following workaround:

  • creating a UCanvasPanel* in the game instance and populating it at start with many (200) widgets
  • adding the GI’s panel to my main widget
  • only managing the visibility (collapsed/visible) of the widgets in real time

The drawback is that i have to work with a fixed (and huge) amount of widgets.

But other than that it works very well and remains perfectly responsive.

Cedric