# UCanvasPanel::AddChildToCanvas is very slow ?

**URL:** <https://forums.unrealengine.com/t/ucanvaspanel-addchildtocanvas-is-very-slow/445292>\
**Category:** Rendering\
**Tags:** canvas, unreal-engine, question\
**Created:** [March 14, 2019, 1:26pm UTC](https://forums.unrealengine.com/t/ucanvaspanel-addchildtocanvas-is-very-slow/445292 "2019-03-14T13:26:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [March 14, 2019, 1:26pm UTC](https://forums.unrealengine.com/t/ucanvaspanel-addchildtocanvas-is-very-slow/445292/1 "2019-03-14T13:26:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [March 20, 2019, 9:16am UTC](https://forums.unrealengine.com/t/ucanvaspanel-addchildtocanvas-is-very-slow/445292/2 "2019-03-20T09:16:03Z")

</div>

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
