godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.1k stars 21.18k forks source link

AudioStreamPlayer2D not working inside a Subviewport no sound is played. #99092

Closed conde2 closed 1 day ago

conde2 commented 1 day ago

Tested versions

v4.3.stable.mono.official [77dcf97d8] v4.4.dev4.mono.official [36e6207bb]

System information

Godot v4.4.dev4.mono - Windows 10.0.19045 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 32.0.15.6094) - AMD Ryzen 7 3700X 8-Core Processor (16 threads)

Issue description

Audio does not play when inside a Subviewport.

image

https://github.com/user-attachments/assets/dc6ba1f2-d617-4c1b-a7f6-6d17e721974e

Steps to reproduce

Enable playing and autoplay in the AudioStreamPlayer2D and move it inside SubViewport and then move it outside.

Minimal reproduction project (MRP)

audiobug.zip

conde2 commented 1 day ago

Searching I found this was a bug before:

https://github.com/godotengine/godot/pull/76713

Maybe it can help finding the solution.

conde2 commented 1 day ago

The problem was that there is an option to enable sound in the viewport. Just enabling it and everything worked.