# Help! Error when cast to + Fade Out Audio

**URL:** <https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614>\
**Category:** Audio\
**Tags:** error, cast-to, unreal-engine, question\
**Created:** [July 24, 2020, 3:15pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614 "2020-07-24T15:15:50Z")\
**Posts on this page:** 14\
**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 24, 2020, 3:15pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/1 "2020-07-24T15:15:50Z")

</div>

So I have to get the sound references from my character blueprint. So I realize a “cast to”, and I recover my variables. Then I apply a “fade out” on them, and it seems to work properly. But when I launch the game and this blueprint is called, the “cast to” is successful, the variables are read but I got an error in the console saying:

Blueprint Runtime Error: “Attempted to access AudioComponent\_0 via property SonNiveau, but AudioComponent\_0 is pending kill”. Blueprint: GameOverWidget Function: Execute Ubergraph Game Over Widget Graph: EventGraph Node: Fade Out

 ![307999-error-cast-to-ue4-help.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/6/226e57323fd43064a9f9e632c46c4b5e0eab2cf9.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 24, 2020, 5:35pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/2 "2020-07-24T17:35:37Z")

</div>

It’s because the player doesn’t exist any more, I think.

---

<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 24, 2020, 9:23pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/3 "2020-07-24T21:23:47Z")

</div>

but it does 😕

---

<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 24, 2020, 10:25pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/4 "2020-07-24T22:25:04Z")

</div>

Well, that’s what the error means.

So it can only be a small number of things, including:

1. The sound has already finished.

2. The actor which made the sound had been destroyed, which I was assuming was your player.

---

<div class="post-metadata">

**Author:** ![PianistaMacabro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pianistamacabro/32/524997_2.png) [@PianistaMacabro](https://forums.unrealengine.com/u/PianistaMacabro)\
**Post date:** [January 10, 2023, 5:27pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/5 "2023-01-10T17:27:45Z")

</div>

I’m having the same problem but in my case I imagine that is because I’m doing it in the wrong way.

It should spawn a sound at a moving object when I enter a trigger box and when I enter a second trigger box a new sound is spawned while the first one fades out. It starts working as I need it (but already showing the error) but after a few trigger boxes enter and reenter the sounds do not fade out anymore.

 ![Screenshot 2023-01-10 141652](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/7/b17cb1932a4ae591a156418b2c92a0c6ab6073b7.jpeg)

@ClockworkOcean is it because the fade out should be reseted or something similar?

Thank you!

---

<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:** [January 10, 2023, 5:58pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/6 "2023-01-10T17:58:45Z")

</div>

I think you need to put the references into variables or an array or something. Because the sounds aren’t getting properly faded, before a new version is played, and the original reference is lost at that point.

It would work if each area was a different blueprint. Trying to control it from the level BP will always land you in a world of pain.

If you make a BP ‘inspectable item’, which can be picked up, has a mesh etc yada yada, and plays a sound, which fades away as you walk off. Each of these things can be a child of that, and it all happens for you. You don’t have to do anything 🙂

---

<div class="post-metadata">

**Author:** ![PianistaMacabro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pianistamacabro/32/524997_2.png) [@PianistaMacabro](https://forums.unrealengine.com/u/PianistaMacabro)\
**Post date:** [January 10, 2023, 6:35pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/7 "2023-01-10T18:35:32Z")

</div>

yes that would be great to simple things up! But unfortunately they are not pickable itens, they are objects following paths at a distance, which you control stepping into trigger boxes.

All that is inside an actor BP. Couldnt I destroy the spawned sound in some way to fix this? And not sounding totally dry? I actually dont need to have much control on the fade out, just need to be a soft ending in some way…did that way because was the way I figure it out, I’m new on blueprints as you can tell hahaha

---

<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:** [January 10, 2023, 7:07pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/8 "2023-01-10T19:07:45Z")

</div>

So you have 3 boxes in one BP, and each plays a sound?

---

<div class="post-metadata">

**Author:** ![PianistaMacabro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pianistamacabro/32/524997_2.png) [@PianistaMacabro](https://forums.unrealengine.com/u/PianistaMacabro)\
**Post date:** [January 10, 2023, 7:18pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/9 "2023-01-10T19:18:51Z")

</div>

yes! and I have two more BP like that (you helped me out in another topic, its the same “3 group with 3 triggers in each” system)

---

<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:** [January 10, 2023, 7:31pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/10 "2023-01-10T19:31:39Z")

</div>

I’ll come back in a little while… 🙂

---

<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:** [January 10, 2023, 8:30pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/11 "2023-01-10T20:30:59Z")

</div>

This sort of setup

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/e/8/3e81e5ff30ca455a9c0f158cd27fc5ed35da12ae.png)

Where play sound is

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/f/0/ef0eaaaa4fbe11cb14381d09c9d25d1f4af9ce0d.png)

( not tested )

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/b/c8bfe5fb66839b9e78f7f095ccad969905b2c63c.png)

everything else is

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/2/962e6727411b890a09a1453c024d9a485dcba62c.png)

---

<div class="post-metadata">

**Author:** ![PianistaMacabro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pianistamacabro/32/524997_2.png) [@PianistaMacabro](https://forums.unrealengine.com/u/PianistaMacabro)\
**Post date:** [January 10, 2023, 8:46pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/12 "2023-01-10T20:46:43Z")

</div>

amazing, would never get to that by myself, really appreciate your help! Thanks!  
Problaby I will have some problems implementing it but gonna make it work haha

---

<div class="post-metadata">

**Author:** ![TwangTV](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TwangTV](https://forums.unrealengine.com/u/TwangTV)\
**Post date:** [January 11, 2023, 8:09am UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/13 "2023-01-11T08:09:39Z")

</div>

Hey man I cant figure out a way to DM you so just replying to a forum thread. Is there any way you could send me the project file if you still have it from this thread. ([Endless Runner: centering the player on a lane after turning a corner - #4 by ClockworkOcean](https://forums.unrealengine.com/t/endless-runner-centering-the-player-on-a-lane-after-turning-a-corner/272945/4)) My discord is Twang#1142 . I am struggling with a similar issue to the guy who made the thread and want to understand how the blueprints work 🙂

Kind Regards, JJ

---

<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:** [January 11, 2023, 8:56pm UTC](https://forums.unrealengine.com/t/help-error-when-cast-to-fade-out-audio/468614/14 "2023-01-11T20:56:12Z")

</div>

Wow, sorry, I just don’t have the project anymore.

I do remember how it works, though. The pictures are enough, actually. It’s always a matter of pulling the player onto a specific line using tick.
