# Can't cast to my Widget blueprint even if I "get all widgets of class".

**URL:** <https://forums.unrealengine.com/t/cant-cast-to-my-widget-blueprint-even-if-i-get-all-widgets-of-class/468377>\
**Category:** UI\
**Tags:** cast-to, unreal-engine, Widget, Blueprint, question\
**Created:** [July 19, 2020, 6:27pm UTC](https://forums.unrealengine.com/t/cant-cast-to-my-widget-blueprint-even-if-i-get-all-widgets-of-class/468377 "2020-07-19T18:27:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![UraniumBonBeurre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UraniumBonBeurre](https://forums.unrealengine.com/u/UraniumBonBeurre)\
**Post date:** [July 19, 2020, 6:27pm UTC](https://forums.unrealengine.com/t/cant-cast-to-my-widget-blueprint-even-if-i-get-all-widgets-of-class/468377/1 "2020-07-19T18:27:57Z")

</div>

So I have to cast to a widget blueprint from another widget blueprint. I used to use the “get all widgets of class” function, but in this case it fails everytime. Any suggestions ?

 ![307581-ue123.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/5/2/7528301ab191f5e1c1a9eec9085f754867e4a3fa.png)

---

<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:** [July 19, 2020, 6:37pm UTC](https://forums.unrealengine.com/t/cant-cast-to-my-widget-blueprint-even-if-i-get-all-widgets-of-class/468377/2 "2020-07-19T18:37:25Z")

</div>

It means you don’t have any widgets of that type running at the moment ( instanced ).

---

<div class="post-metadata">

**Author:** ![UraniumBonBeurre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UraniumBonBeurre](https://forums.unrealengine.com/u/UraniumBonBeurre)\
**Post date:** [July 19, 2020, 9:08pm UTC](https://forums.unrealengine.com/t/cant-cast-to-my-widget-blueprint-even-if-i-get-all-widgets-of-class/468377/3 "2020-07-19T21:08:48Z")

</div>

And how to solve this issue in my case?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [July 20, 2020, 7:32am UTC](https://forums.unrealengine.com/t/cant-cast-to-my-widget-blueprint-even-if-i-get-all-widgets-of-class/468377/4 "2020-07-20T07:32:40Z")

</div>

Create the widget first. You cannot access something that does not exist.

---

<div class="post-metadata">

**Author:** ![BDC\_Patrick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bdc_patrick/32/1104221_2.png) [@BDC\_Patrick](https://forums.unrealengine.com/u/BDC_Patrick)\
**Post date:** [May 28, 2022, 8:49am UTC](https://forums.unrealengine.com/t/cant-cast-to-my-widget-blueprint-even-if-i-get-all-widgets-of-class/468377/5 "2022-05-28T08:49:04Z")

</div>

In Addition to Everynone:  
Always do a valid check before trying to use reference and stuff.

2 ways for you.

1.: Check if the Length of the GetAllActorsOfClass Array is bigger than 0.

2.: If you store something in a variable, get this variable (drag drop into graph), rightclick it and convert to validate check.

Be sure to always checked for such things, to avoid None Property Errors and failed casts.
