diff --git a/src/DynamicSoundFXPlayer.gd b/src/DynamicSoundFXPlayer.gd index af71ed1..c9151dc 100644 --- a/src/DynamicSoundFXPlayer.gd +++ b/src/DynamicSoundFXPlayer.gd @@ -18,8 +18,12 @@ extends AudioStreamPlayer var _core : DynamicSoundFXPlayerCore; 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("FX") != -1: + bus = "FX"; func _ready() -> void: _core = DynamicSoundFXPlayerCore.new(self); diff --git a/src/DynamicSoundFXPlayer2d.gd b/src/DynamicSoundFXPlayer2d.gd index 0ff84e8..71c4447 100644 --- a/src/DynamicSoundFXPlayer2d.gd +++ b/src/DynamicSoundFXPlayer2d.gd @@ -17,8 +17,12 @@ extends AudioStreamPlayer2D var _core : DynamicSoundFXPlayerCore; 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("FX") != -1: + bus = "FX"; func _ready() -> void: _core = DynamicSoundFXPlayerCore.new(self); diff --git a/src/DynamicSoundFXPlayer3d.gd b/src/DynamicSoundFXPlayer3d.gd index e21220d..fdd6613 100644 --- a/src/DynamicSoundFXPlayer3d.gd +++ b/src/DynamicSoundFXPlayer3d.gd @@ -17,8 +17,12 @@ extends AudioStreamPlayer3D var _core : DynamicSoundFXPlayerCore; 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("FX") != -1: + bus = "FX"; func _ready() -> void: _core = DynamicSoundFXPlayerCore.new(self); diff --git a/src/DynamicSoundPlayer.gd b/src/DynamicSoundPlayer.gd index 827754e..54b7c10 100644 --- a/src/DynamicSoundPlayer.gd +++ b/src/DynamicSoundPlayer.gd @@ -42,8 +42,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"]: diff --git a/src/DynamicSoundPlayer2d.gd b/src/DynamicSoundPlayer2d.gd index 61ab21e..e16a155 100644 --- a/src/DynamicSoundPlayer2d.gd +++ b/src/DynamicSoundPlayer2d.gd @@ -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"]: diff --git a/src/DynamicSoundPlayer3d.gd b/src/DynamicSoundPlayer3d.gd index e294db2..4cc5ca7 100644 --- a/src/DynamicSoundPlayer3d.gd +++ b/src/DynamicSoundPlayer3d.gd @@ -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"]: