Scene fading from white, and playing audio?

So I want my game to start with the first scene (cinematic) to fade in from white, and then for some audio files to play.

I’ve already got the audio to play on scene start, but I need it to play at very specific points (like at the scene start, and then exactly as the fading starts). (I’m going to put an intro in later, so the two sounds can play at the same time for now)

I tried watching a bunch of videos, some from very popular people like “Brackeys”, but every single video does it a lot differently. Brackeys makes like a 30 liner script, and puts it in an empty object (which doesn’t work for me because he also triggers something from that script inside another script on player collision), while other people just put a 2D texture in front of the camera object within the editor, and used a script that calls for all the GameObjects, like the player, camera, and texture, and edit some properties accordingly.

Can someone please tell me the most up-to-date way of making a scene fade in/out on scene start? And also, a way of playing the audio in relation to the fading effect’s lifetime?

you could use a canvas and just set a white image to cover the screen and then just fade over 2-3seconds

1 Like

Well, I’ll start out saying there is no “up to date” way. Everyone does it different and they will all work for different things.

However, I would suggest a tweening engine. LeanTween or Dotween. (I use LeanTween). I’m not sure how Dotween handles things, but for Leantween we use a white image that is full screen. We can fade this from max alpha to 0 and then when it completes, we can play audio, swap scenes, start our level, whatever we want. It also includes an update call, so if we wanted something to start halfway through the fade or whatever, we can do that.

Now, if you want audio to play when fading starts, you would do that in just a method that you would call from start. Then they would just happen together. Your audio would start and then the tween engine should start the fade.

2 Likes