Is there a way to make a SpatialAudio object autoplay its assigned track strictly via settings in Reality Composer Pro, no Swift code involved?
Yep, this is possible thanks to the new version of RCP. I chose AtmospheresOcean
.caf audio from Reality Composer Pro's free library. Then I put a track in Timelines
editor. After that I added the OnAddedToScene
behavior with Timeline action on Entity. And do not forget to supply AudioLibrary resources with AtmospheresOcean
sound.
This code is enough to auto-play your spatial sound as soon as the scene starts.
RealityView { rvc in
let scene = try! await Entity(named: "Immersive", in: rkcb)
rvc.add(scene)
}