# Cast Failing all over the place

**URL:** <https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193>\
**Category:** Blueprint\
**Tags:** casting, cast-failed, unreal-engine, Blueprint, question\
**Created:** [April 2, 2020, 1:06am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193 "2020-04-02T01:06:20Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 1:06am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/1 "2020-04-02T01:06:20Z")

</div>

![298970-screenshot-2020-04-02-at-020221.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/9/129f55202afc5052c654e7376ec4a16fc3a03dad.png)

Does anyone know why this cast could or does fail? I have used this method a tonne of times with no issues. I am having a similar issue with my get player controller cast to my player controller. I have another project where I do the exact same thing and it works!

Is there some fundamental thing that I am missing in this project compared to others?

Thanks

---

<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:** [April 2, 2020, 7:56am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/2 "2020-04-02T07:56:04Z")

</div>

When you open the _Player Character Base_ blueprint, what does it say about its _Parent class:_ in the very upper right corner?

Apart from that, ensure there is a character assigned in the GameMode.

---

<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:** [April 2, 2020, 7:57am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/3 "2020-04-02T07:57:03Z")

</div>

Hi - all it means, is that THAT player character is not of type PlayerCharacterBase.

Please double check 🙂

---

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 10:48am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/4 "2020-04-02T10:48:45Z")

</div>

Character

It also happens with the game instance, which is definitely a game instance.

 ![298988-screenshot-2020-04-02-at-114755.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/c/2/5c238a39246606601745f95bcd5f63f5d7e17ca6.png)

---

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 10:54am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/5 "2020-04-02T10:54:09Z")

</div>

The get player character node is a function that is linked to the parent class of the “Character” class. So the PlayerCharacterBase could well not be a “Character” class which would cause an issue, but it is a character. So the get player character node should be able to call the character I have made because it is of the character class.

It is also happening with the player controller which is of player controller class.

Both of which I have used several times in other projects and been successful.

---

<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:** [April 2, 2020, 10:59am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/6 "2020-04-02T10:59:48Z")

</div>

Can you try this on the fail?:

 ![298989-cast.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/5/e65ebb6514ea229f11a056c1827a0bf9a3d5e7ed.jpeg)

( imagine it’s the right kind of cast 😉 )

---

<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:** [April 2, 2020, 11:53am UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/7 "2020-04-02T11:53:46Z")

</div>

Can’t cast to GameInstance → it was not assigned in the Project Settings

Can’t cast to GameMode framework elements → the level you’re in is not running the correct Game Mode.

Worth double checking if all else fails.

---

<div class="post-metadata">

**Author:** ![ndelchen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ndelchen](https://forums.unrealengine.com/u/ndelchen)\
**Post date:** [April 2, 2020, 12:35pm UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/8 "2020-04-02T12:35:25Z")

</div>

You could print the class type name. This could help for further investigation.

---

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 12:45pm UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/9 "2020-04-02T12:45:50Z")

</div>

So I tried the exact same thing in the Third person Example project and it works how I would expect it to work, so I am clearly doing something wrong in my project somewhere that none of my casts are working.

I just need to work out what is happening in the third person example that isn’t happening in mine.

---

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 12:52pm UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/10 "2020-04-02T12:52:39Z")

</div>

![298994-screenshot-2020-04-02-at-135131.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/9/4b9939fd8c6f68a6068b70ddecf639da925e616c.png)

---

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 12:54pm UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/11 "2020-04-02T12:54:23Z")

</div>

Thanks, I already set up the Game instance in the project settings and set up the game mode while I was there, did this at the very beginning of the project before I started doing anything else.

So both those should be working as intended.

---

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 1:16pm UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/12 "2020-04-02T13:16:22Z")

</div>

Right, I have absolutely no idea what I did between last night and today, I deleted all my code, re-did all of may variables and it seems to work!?..after doing it in 2 other projects.

I have no idea what happened? Maybe the editor had a melt down I had been working in it for 12 hours straight.

Anyway, thanks to everyone who offered their help and advice, I wish I could tell you what solved the issue but I really have no clue at all, just re-opened the project re-did the casts and they worked.

---

<div class="post-metadata">

**Author:** ![MAIKERU\_Jackson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MAIKERU\_Jackson](https://forums.unrealengine.com/u/MAIKERU_Jackson)\
**Post date:** [April 2, 2020, 1:17pm UTC](https://forums.unrealengine.com/t/cast-failing-all-over-the-place/463193/13 "2020-04-02T13:17:51Z")

</div>

Thanks for your time, no idea what happened but it seems to have resolved its self and allows me to use the exact same casts successfully now after a re-boot of the engine.
