# Why is the Cast always fails?

**URL:** <https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495>\
**Category:** Editor Scripting\
**Tags:** reference, cast-failed, UE4-20, unreal-engine, pawn, question, Blueprint\
**Created:** [October 26, 2018, 8:26pm UTC](https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495 "2018-10-26T20:26:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lemix028](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lemix028](https://forums.unrealengine.com/u/Lemix028)\
**Post date:** [October 26, 2018, 8:26pm UTC](https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495/1 "2018-10-26T20:26:24Z")

</div>

The Cast failed always, I do not know anymore what to do is to fix it ^^  
I just want to save the Reference in a variable but it always failed.

 ![257830-camerapawncontroller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/5/9f577465ff08cc92b586edc3b14561fe28640693.png)

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![TestyRabbit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TestyRabbit](https://forums.unrealengine.com/u/TestyRabbit)\
**Post date:** [October 26, 2018, 8:31pm UTC](https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495/2 "2018-10-26T20:31:45Z")

</div>

Because you’re trying to cast the player pawn to a camera pawn, which will never work, because the player pawn is not a camera pawn. If you would like to get the camera from a player, trying getting the player camera manager.

> **[Get Player Camera Manager](https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Game/GetPlayerCameraManager/)**
>
> Get Player Camera Manager

---

<div class="post-metadata">

**Author:** ![Lemix028](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lemix028](https://forums.unrealengine.com/u/Lemix028)\
**Post date:** [October 26, 2018, 8:43pm UTC](https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495/3 "2018-10-26T20:43:07Z")

</div>

Thanks for the answer but it still fails.

 ![257831-camerapawncontroller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/b/4abc8abe56e5be523f4af8e0492965d9325df124.png)

---

<div class="post-metadata">

**Author:** ![TestyRabbit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TestyRabbit](https://forums.unrealengine.com/u/TestyRabbit)\
**Post date:** [October 26, 2018, 11:52pm UTC](https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495/4 "2018-10-26T23:52:33Z")

</div>

See at the bottom where it says “‘Camera Pawn’ does not inherit from ‘Player Camera Manager’”? That means that cast will fail 100% of the time. From what it seems like, you’re trying to get the player’s camera, right? Is this in the player blueprint? Or where are you trying to do this?

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [October 27, 2018, 3:13am UTC](https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495/5 "2018-10-27T03:13:05Z")

</div>

Try this if you just want the player’s camera

 ![257854-casting.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/e/02e3bec14987caf8cc446be7a1118310d1d7923c.jpeg)

---

<div class="post-metadata">

**Author:** ![Lemix028](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lemix028](https://forums.unrealengine.com/u/Lemix028)\
**Post date:** [October 27, 2018, 5:59pm UTC](https://forums.unrealengine.com/t/why-is-the-cast-always-fails/436495/6 "2018-10-27T17:59:09Z")

</div>

I found my mistake.I forgot in the GameMode to change the Default Pawn Class.  
Nevertheless many thanks
