Music file works in editor but missing after export to iOS
Hey everyone,
I’m having trouble with an exported iOS build — the music plays fine in the editor, but after exporting to iOS the app throws this error:
core/variant/variant_utility.cpp:1024:push_error(): Music file not found: uid://lecq5ixjyy1
Music file not found: uid://lecq5ixjyy1
GDScript backtrace (most recent call first):
[0] _load_audio (res://Components/MusicPlayer/MusicPlayer.gd:136)
[1] _ready (res://Components/MusicPlayer/MusicPlayer.gd:27)
[2] _on_practice_button_pressed (res://Scenes/MainScene.gd:114)
I’ve already tried:
• Reimporting the audio files
• Clearing the .godot folder
• Double-checking the res:// path in the script
• Rebuilding the export project from scratch
The audio file plays perfectly in the editor preview but just fails to load on iOS.
Has anyone run into this before? Any tips on how to debug missing resources on iOS exports or make sure the .import/uid files are correctly included in the exported build?
I’ve already resolved this, so I’m posting the solution for anyone who runs into the same issue.
The problem was not that the music files were missing from the iOS export. The real issue was my own existence check. In my custom music player, I was verifying the audio file using a file-exists check before loading it. This check always failed on exported builds.
Audio resources referenced via res:// (and especially uid://) are not real files on disk after export. Because of that:
FileAccess.file_exists(…) does not work for exported resources
uid:// paths are virtual and cannot be validated via filesystem APIs
Despite the failed check, the audio files themselves were correctly bundled and playable.
Correct approach (from Godot documentation):
Do not use FileAccess.file_exists() for res:// resources
Either:
Load directly and check the result:
var stream := load("res://audio/music.ogg")
if stream:
audio_player.stream = stream