# Widget won't Disappear after Timer is done.

**URL:** <https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558>\
**Category:** UI\
**Tags:** timer, unreal-engine, remove, Widget, Blueprint, question\
**Created:** [September 15, 2016, 3:56pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558 "2016-09-15T15:56:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 3:56pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/1 "2016-09-15T15:56:02Z")

</div>

Okay I have a timer that starts as I pick up a collectible item, but no matter what I do, when the timer hits 0, the 0 stays on the screen…

It is supposed to destroy my object, and start a timer that displays on the screen.When the timer hits 0 I want it to remove the timer widget from the viewport. The problem is, the 0 stays on the screen. Any ideas?

 ![107172-mustart+revamp+1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/a/9/fa94eaac691f9a79ccf67b545e57c7dd886ea3f8.png)

The solution:

 ![107240-mustard+widget+solution.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/f/d3f31c218f342fe7ba07f66835ba74b75406f0ef.png)

It turns out the problem was that I was making 20 widgets and then only deleting one. My solution was to add a delay node that would delay the sequence by one second, and then remove the widget as the next one was being created. So the timer would say 20, and 1 second later, the 20 would be deleted at the same time as the 19 appeared on the screen, giving it a seamless transition in a timer look-alike.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ecb5cc49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ecb5cc49](https://forums.unrealengine.com/u/anonymous_user_ecb5cc49)\
**Post date:** [September 15, 2016, 4:28pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/2 "2016-09-15T16:28:57Z")

</div>

I think you need to pass `Self` into your `SetTimerByFunctionName` node as the `Object` param

---

<div class="post-metadata">

**Author:** ![CriErr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CriErr](https://forums.unrealengine.com/u/CriErr)\
**Post date:** [September 15, 2016, 4:31pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/3 "2016-09-15T16:31:45Z")

</div>

Problem might be in the “function part”, since you used custom event.

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 4:56pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/4 "2016-09-15T16:56:39Z")

</div>

But it all works correctly until it comes to removing the widget. Everything is working, but when the timer hits 0, the 0 stays on the screen. I just replaced the function part with a set timer by even node, and it did the same thing.

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 4:57pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/5 "2016-09-15T16:57:07Z")

</div>

I’m not quite sure what you mean.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ecb5cc49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ecb5cc49](https://forums.unrealengine.com/u/anonymous_user_ecb5cc49)\
**Post date:** [September 15, 2016, 5:02pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/6 "2016-09-15T17:02:24Z")

</div>

Take a look at your `SetTimerByFunctionName` node, the 1st param it takes is called `Object`, you need to pass something into that. Drag off that pin and type `Self`. That’s what you need.

The problem, I think, is that `SetTimerByFunctionName` doesn’t know what object that function lives on. It may be obvious to you that the `MustartdTime` function lives on `2DSideScrollerCharacter` but it doesn’t know that

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 5:05pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/7 "2016-09-15T17:05:29Z")

</div>

I tried that, didn’t work. Also tried adding the reference to self on the clear timer node, that didn’t work either.

---

<div class="post-metadata">

**Author:** ![CriErr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CriErr](https://forums.unrealengine.com/u/CriErr)\
**Post date:** [September 15, 2016, 5:05pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/8 "2016-09-15T17:05:48Z")

</div>

no, its self by default, this part is fine.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ecb5cc49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ecb5cc49](https://forums.unrealengine.com/u/anonymous_user_ecb5cc49)\
**Post date:** [September 15, 2016, 5:08pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/9 "2016-09-15T17:08:16Z")

</div>

the only other thing I can think of is something is wrong w/ your `MustardCountdown` decrement logic. Can you post that? Might be better to use the `NearlyEqual` node instead of `<=`. Floats can be funny

---

<div class="post-metadata">

**Author:** ![CriErr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CriErr](https://forums.unrealengine.com/u/CriErr)\
**Post date:** [September 15, 2016, 5:10pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/10 "2016-09-15T17:10:25Z")

</div>

ok, maybe they fixed it.

so, whats going on here [http://puu.sh/rcfm6.png](http://puu.sh/rcfm6.png)

if branch false, you create widget and add it to viewport, but if branch true you attempt to remove from parent widget which is not created, output of create widget function. It doesnt have any sence.

I believe you should even have log warning messages about input of remove from parent not being valid, check output log.

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 5:15pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/11 "2016-09-15T17:15:14Z")

</div>

The timer is counting down. If the timer is above 0 it goes through the false branch and creates the widget that displays the countdown. Once the timer hits 0, it goes through the true branch, and since the widget was created from the false branch, there is a widget to remove. It just doesn’t remove it and the 0 sits on the screen.

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 5:28pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/12 "2016-09-15T17:28:49Z")

</div>

It’s in the original picture up there… I somehow deleted the line that displays the image but the link to view it is still there. Basically, every 1 second the set timer node calls the MustardTime event. The mustard time event subtracts 1 every time it is called, which is every second, which is how the timer counts down. As the timer is counting down, while it is above 0 the branch is false, so it creates the widget. Once it hits 0 it sends a signal to true where it is supposed to erase the widget. The problem is, it doesn’t erase (I ran the game with the bueprint open so I could see the signals. It DOES send a signal down the true path, it just doesn’t remove the timer widget from the screen).

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ecb5cc49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ecb5cc49](https://forums.unrealengine.com/u/anonymous_user_ecb5cc49)\
**Post date:** [September 15, 2016, 5:33pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/13 "2016-09-15T17:33:02Z")

</div>

wait a sec, you’re not storing the widget you’re creating. You can’t hook the creation up to the remove node. Store the widget as a variable when you create it and remove that from the parent instead

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 5:42pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/14 "2016-09-15T17:42:26Z")

</div>

I see what you are saying, how would I go about doing that? (I’m still a noob when it comes to this. I’m trying to learn by making a 2d scroller that isn’t going so well haha)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ecb5cc49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ecb5cc49](https://forums.unrealengine.com/u/anonymous_user_ecb5cc49)\
**Post date:** [September 15, 2016, 5:47pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/15 "2016-09-15T17:47:22Z")

</div>

Right click `ReturnValue` on the `CreateMustardTimerWidget` node and select Promote to Variable to create a variable and then fix your execution line if needed. It should automatically create a setter for IIRC

Drag that variable out onto your graph and click Get to get it. Hook the get one up to `RemoveFromParent` and unhook the other one from `RemoveFromParent`

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 6:09pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/16 "2016-09-15T18:09:41Z")

</div>

I posted a screenshot of the change, did I do it rght? Because that still doesn’t work.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ecb5cc49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ecb5cc49](https://forums.unrealengine.com/u/anonymous_user_ecb5cc49)\
**Post date:** [September 15, 2016, 6:14pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/17 "2016-09-15T18:14:36Z")

</div>

Yep, that’s right. Now you need to see how many time your calling the false branch of that function before you call the remove. I have a suspicion that you’re creating \>1 widget.

Put a break point on both the `AddToViewport` and `RemoveFromParent` nodes. see how many times `AddToViewport` is called before `RemoveFromParent` is called.

---

<div class="post-metadata">

**Author:** ![CriErr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CriErr](https://forums.unrealengine.com/u/CriErr)\
**Post date:** [September 15, 2016, 6:46pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/18 "2016-09-15T18:46:06Z")

</div>

oh, that’s looping timer, maybe then you should use timeline?

---

<div class="post-metadata">

**Author:** ![Cougarkillz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cougarkillz](https://forums.unrealengine.com/u/Cougarkillz)\
**Post date:** [September 15, 2016, 7:47pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/19 "2016-09-15T19:47:20Z")

</div>

It looks like it does it once per tick, so by the end there are 20 of them. Is that why the number stays there? It makes 20 but only erases one?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ecb5cc49](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ecb5cc49](https://forums.unrealengine.com/u/anonymous_user_ecb5cc49)\
**Post date:** [September 15, 2016, 8:06pm UTC](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558/20 "2016-09-15T20:06:06Z")

</div>

Yes, you’re only erasing 1. You need to prevent it from creating more than 1. Or create 1 initially and toggle visibility instead of create/destroy

[Next page](https://forums.unrealengine.com/t/widget-wont-disappear-after-timer-is-done/370558.md?page=2)
