How can I play music when a scene's camera starts rendering?

I’m helping some game design students make a horror game with the HDRP pipeline in Unity 2022.3.26f

I’ve got a “CoreSystems” scene holding a application manager gameobject that on Start() asynchronously loads the “Main Menu Scene” from an addressables reference.

This menu scene has a camera, some environmental geometry, a global pre-processing volume to give it a haunted appearence, and a world space UI canvas. It also has a script on the camera where on Start() it will invoke the AudioManager’s static PlayMusic action that activates it’s audiosource (this manager being in the core systems scene).

What I’m noticing in the editor on entering play mode (which also correlates to build behaviour) is that the scene will load (going from grey to white text in the heirarchy window), the music will start playing (so start() gets triggered in the scene), but the scene’s camera won’t start rendering until about 3s later (at which time the editor will show a drop down arrow for the scene’s gameobjects).

Not sure which end of the beast is the head so to speak… :sweat_smile:

I originally thought the async scene loading was the issue and tried hooking into SceneManager.SceneLoaded to trigger the music but that get executed between OnEnable and Start.

I then tried researching how to trigger callbacks when a camera starts renders and found out I could hook into BeginCameraRendering but what happened then was music would start to play about half a second before the camera rendered but then abruptly stop. Bug?

Any guidance would be appreciated :slight_smile:

Also here’s a gif to show the camera delay.

HDRPCameraRenderDelayWhenAsyncSceneLoading