# Setting Boolean doesn't work

**URL:** <https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434>\
**Category:** Character & Animation\
**Tags:** boolean, unreal-engine, question\
**Created:** [February 25, 2021, 10:12pm UTC](https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434 "2021-02-25T22:12:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4e0c65a9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4e0c65a9](https://forums.unrealengine.com/u/anonymous_user_4e0c65a9)\
**Post date:** [February 25, 2021, 10:12pm UTC](https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434/1 "2021-02-25T22:12:12Z")

</div>

I’m making a menu with different animations. Now I want to play different animations based on which menu('s) is/are open, like this:[Snip - freesnippingtool.com\_capture\_20210225230910.png | ImgHostr](https://imghostr.com/e016e3_yxs)

The Boolean ‘bIsOptionsActive’ is set when I hit a button to go to options, like this: [Snip - freesnippingtool.com\_capture\_20210225231039.png | ImgHostr](https://imghostr.com/feaded_4d9)

I’m guessing I’m doing something wrong with setting the boolean, but I really don’t have a clue how to fix it. All help is appreciated.

---

<div class="post-metadata">

**Author:** ![Anonymous\_80a6c5fd13a5bb3f2cf2b0de25c81196](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_80a6c5fd13a5bb3f2cf2b0de25c81196](https://forums.unrealengine.com/u/Anonymous_80a6c5fd13a5bb3f2cf2b0de25c81196)\
**Post date:** [February 26, 2021, 1:41am UTC](https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434/2 "2021-02-26T01:41:45Z")

</div>

it seems nothing wrong to me

i think you should check executing it properly, like using print. maybe wrong cast in first place

and how about make Enum and execute by switch, it also gave you what you want and pretty

alt text

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [February 26, 2021, 11:36am UTC](https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434/3 "2021-02-26T11:36:31Z")

</div>

You need to do the RemoveFromParent last. It’s just not running the rest of the code…

---

<div class="post-metadata">

**Author:** ![FatalBreak](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FatalBreak](https://forums.unrealengine.com/u/FatalBreak)\
**Post date:** [February 26, 2021, 3:47pm UTC](https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434/4 "2021-02-26T15:47:43Z")

</div>

If all of this is being done in the same widget then Clockwork is right in stating the issue w/ the remove from parent node. That will destroy the widget and nothing after it will be ran. That should be the last thing done. In addition, if you’re using other widgets for sub menu’s, then you need to place the boolean variables in a different area that isn’t destroyed like the blueprints are such as player character or game mode if it’s singleplayer. If you destroy the widget, the variable is also destroyed and the state is lost.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4e0c65a9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4e0c65a9](https://forums.unrealengine.com/u/anonymous_user_4e0c65a9)\
**Post date:** [March 2, 2021, 11:35am UTC](https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434/5 "2021-03-02T11:35:38Z")

</div>

Should this be done by making a new class, or can I just do it in a existing class. And if I put it in a different class and cast to from widget to the class with booleans, what do I put in object? Thanks for your answer.

---

<div class="post-metadata">

**Author:** ![FatalBreak](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FatalBreak](https://forums.unrealengine.com/u/FatalBreak)\
**Post date:** [March 3, 2021, 10:54pm UTC](https://forums.unrealengine.com/t/setting-boolean-doesnt-work/479434/6 "2021-03-03T22:54:53Z")

</div>

I would say that the Parent widget is a good place to hold those because if the parent widget is destroyed, then all children should also be destroyed it looks like in your situation. You shouldn’t ever have no main menu but the video options are open.

If you ARE wanting to have like 3-5 widgets open then HUD may be the place to store them and just do children off there.
