auto-detect Music/FX bus in editor
When a player enters the tree in the editor, if its bus is still the default "Master" and a "Music" (or "FX") bus exists in the AudioServer, switch to that. User-customised buses are not overridden. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
cb47d89377
commit
7f227acb6a
@@ -41,8 +41,12 @@ func _set(property: StringName, value: Variant) -> bool:
|
||||
return false;
|
||||
|
||||
func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint() and stream == null:
|
||||
if not Engine.is_editor_hint():
|
||||
return;
|
||||
if stream == null:
|
||||
stream = AudioStreamPolyphonic.new();
|
||||
if bus == &"Master" and AudioServer.get_bus_index("Music") != -1:
|
||||
bus = "Music";
|
||||
|
||||
func _validate_property(property: Dictionary) -> void:
|
||||
if property.name in ["RandomMinPitchScale", "RandomMaxPitchScale"]:
|
||||
|
||||
Reference in New Issue
Block a user