Help! Error when cast to + Fade Out Audio

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

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

but it does :confused:

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.

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.

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

Thank you!

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 :slight_smile:

1 Like

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

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

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)

I’ll come back in a little while… :slight_smile:

This sort of setup

Where play sound is

( not tested )

image

everything else is

image

1 Like

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

1 Like

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) 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 :slight_smile:

Kind Regards, JJ

1 Like

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.