# Why would this cast fail when its connected to an input action, but not when its connected to anything else? 

**URL:** <https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302>\
**Category:** Blueprint\
**Tags:** casting, cast-failed, unreal-engine, Blueprint, question\
**Created:** [September 19, 2025, 6:20pm UTC](https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302 "2025-09-19T18:20:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cloak\_Enjoyer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cloak\_Enjoyer](https://forums.unrealengine.com/u/Cloak_Enjoyer)\
**Post date:** [September 19, 2025, 6:20pm UTC](https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302/1 "2025-09-19T18:20:33Z")

</div>

Hello! Im trying to do a simple cast to another Character Blueprint, but for some reason, when the cast is connected to an Input Action (In this case the R key) It does not work! I added these Print Strings to check when the cast fails and every time i press R i get “Bye” (Cast Failed.) the strangest thing here tho is when i plugged the cast node into beginplay, the cast worked! displaying “Bye” and “Hello” at the same time but ultimately working. Can someone explain what is going on in here? And yes, the Character Reference variable IS actually a character reference and BP\_Dozer is parent class Character. Im stuck!

 ![Screenshot_7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/c/d3c4e5970001834b9f1f2f5966499a62f035a7f4.png)

---

<div class="post-metadata">

**Author:** ![L1z4rD89](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/l1z4rd89/32/1194537_2.png) [@L1z4rD89](https://forums.unrealengine.com/u/L1z4rD89)\
**Post date:** [September 19, 2025, 6:45pm UTC](https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302/2 "2025-09-19T18:45:13Z")

</div>

Hey @Cloak_Enjoyer

is your character reference valid? Can you show where you set this reference?

```auto
displaying “Bye” and “Hello” at the same time

```

Do you use the CastToBP\_Dozer node anywhere else?

---

<div class="post-metadata">

**Author:** ![Cloak\_Enjoyer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cloak\_Enjoyer](https://forums.unrealengine.com/u/Cloak_Enjoyer)\
**Post date:** [September 19, 2025, 6:52pm UTC](https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302/3 "2025-09-19T18:52:13Z")

</div>

Hi! thanks for answering. Im pretty sure it is valid, and no i did not use CastToBP\_Dozer anywhere else. But when that node is plugged into beginplay i get both messages at once.

 ![Screenshot_8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/9/279d2bdf50d074116e127d0de638c04c11e4c36b.png)

---

<div class="post-metadata">

**Author:** ![L1z4rD89](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/l1z4rd89/32/1194537_2.png) [@L1z4rD89](https://forums.unrealengine.com/u/L1z4rD89)\
**Post date:** [September 19, 2025, 7:18pm UTC](https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302/4 "2025-09-19T19:18:37Z")

</div>

Hey @Cloak_Enjoyer

these are the settings for your variable. With this you create an empty placeholder. Then you have to set it:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/d/ead721b06071aa6018d18ee46134900718fa3936.png)

IsValid can tell you if this CharacterRefence is/was set.

E.g. you can do something like this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/9/3/5933e8b2bcb57b8a9739980318bc0c94a1949a34.jpeg)

1. An Actor overlaps a SphereCollision
2. We check if this OtherActor is of type BP\_Dozer
3. If it is of type BP\_Dozer and the cast is a success =\> Save this BP\_Dozer as CharacterReference for later use

You need an actor for your CastTo node and for this you can use Overlap events or GetAllActors

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/8/b/08b6d54e05c23f8de248def1de21ed7e1e321f2d.png)

(don’t use it when you have tons of actors in a level) etc..

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [September 19, 2025, 7:52pm UTC](https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302/5 "2025-09-19T19:52:19Z")

</div>

Your screenshot shows that the reference is empty, thus null.  
Are you Setting it in code?

* * *

Every instance of the class executes Begin play. The servers copy, Autonomous and Simulated.

One player in multiplayer setup would print 2 messages.  
2 players in multiplayer would print 6 technically one per proxy per Instance.

---

<div class="post-metadata">

**Author:** ![Cloak\_Enjoyer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cloak\_Enjoyer](https://forums.unrealengine.com/u/Cloak_Enjoyer)\
**Post date:** [September 19, 2025, 8:05pm UTC](https://forums.unrealengine.com/t/why-would-this-cast-fail-when-its-connected-to-an-input-action-but-not-when-its-connected-to-anything-else/2658302/6 "2025-09-19T20:05:12Z")

</div>

I can cast perfectly now 😃 thanks!
