Autoload scene not working on Android

Godot Version

v4.2.1.stable.official [b09f793f5]


I’m making a simple 2d game for mobile and pc, I’ve made main menu scene with button “Play”, when you click it, it opens level select scene. Also, main menu scene had a background music and changing themes just stopped this music.

It was a big problem, until I found this tutorial:
I made the same thing and made a “global” scene that has background music, then I added it to my project autoload and on main menu scene load it plays music from global scene and it works perfectly on my .exe builds and in debug!

But now I downloaded Bluestacks 5, exported as apk, everything is works, other sounds are playing, everything is just perfect! But main menu music doesn’t play at all, it worked before, but now somehow stopped…

Also I’ve tested it on my old Android, the same thing…
I think, it stopped working after I added Discord RPC to my game: 4.0.X Discord Game SDK / Editor Presence Addon - Godot Asset Library

But when I’m commented all code that works with Discord RPC and disabled it in import, nothing changed, music still not playing… (I’m not removed it at all, just disabled, maybe, this means something)

Hope, there’s any way to fix this without removing discord rpc, because I really want to keep this :slight_smile:

One second, I’ll check, but, how I remembered, it was activated for all time. Also, you’ve said to try $ClassName.start()? Is that for AudioStreamPlayer2D or Node2D scene has this feature? Because I use this scene instead of just AudioStreamPlayer2D, because my global scene also has other things

Sorry for long answer, my project got corrupted again, here’s screenshot, everything is turned on, so… I think that discord does something, idk.

The $ClassName.start() is when the scene loads. Forgot about it. Does the sound work in your editor?
And can you show the code from the global autoload. Try to create a second global autoload and see if it works there. (to exclude the bug)

1 Like

Yes, it works, also, here’s a code from autoload:

func play_sound(sound: String, check_for_silence: bool=true):
	var sound_node = get_node(sound)
	if not check_for_silence or not sound_node.playing:
func stop_sound(sound: String):


func _ready():

Also I want to say, I found a fix, I’ve tried again to disable discord rpc, but now not the plugin, but my functions to make easier work with this thing:

class Discord:
	static func initialize():
		#DiscordSDK.app_id = someappid
	static func set_details(details: String):
		#DiscordSDK.details = details
	static func set_state(state: String):
		#DiscordSDK.state = state
	static func set_large_image(image: String):
		#DiscordSDK.large_image = image
	static func set_small_image(image: String):
		#DiscordSDK.small_image = image
	static func set_large_text(text: String):
		#DiscordSDK.large_image_text = text
	static func set_small_text(text: String):
		#DiscordSDK.small_image_text = text
	static func update_start_time():
		#DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
	static func set_end_time(time: int):
		#DiscordSDK.end_timestamp = time
	static func update():

After that, it worked! So… I think I’ll add global boolean - android_build and I’ll check for that to make these functions work or not. I know, it’s a bit stupid solution, but that’s the only thing I have right now

1 Like