# CPU hitch when creating new widget.

**URL:** <https://forums.unrealengine.com/t/cpu-hitch-when-creating-new-widget/837926>\
**Category:** Blueprint\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [April 1, 2023, 9:21pm UTC](https://forums.unrealengine.com/t/cpu-hitch-when-creating-new-widget/837926 "2023-04-01T21:21:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LABS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LABS](https://forums.unrealengine.com/u/LABS)\
**Post date:** [April 1, 2023, 9:21pm UTC](https://forums.unrealengine.com/t/cpu-hitch-when-creating-new-widget/837926/1 "2023-04-01T21:21:02Z")

</div>

Hi everyone, I’m profiling my game right now and I’m noticing an almost 100 ms hitch when I create and set a UMG widget via blueprint. For context, when an enemy in my game takes damage for the first time, I create a healthbar widget on the first instnace of damage. This is when the hitch occurs.

What’s interesting is that this happens only the **first time I create the widget**. Any subsequent enemies that take damage and run the function won’t hitch. Here’s the function:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/f/80f44887e85ca1472d8094f009f00e2e8187799e.png)

The hitch happens on the “set variable” function.

Anyone have any idea of what’s going on? Seems like its related to the creation of the widget, so I almost wonder if a solution is to just spawn this widget prior, so the hitch doesn’t happen in the heat of combat.
