Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaged as .app on the macOS platform, assets cannot be read. #15618

Open
mzdk100 opened this issue Oct 3, 2024 · 0 comments
Open

Packaged as .app on the macOS platform, assets cannot be read. #15618

mzdk100 opened this issue Oct 3, 2024 · 0 comments
Labels
A-Assets Load files from disk to use for things like images, models, and sounds O-MacOS Specific to the MacOS (Apple) desktop operating system S-Needs-Help The author needs help finishing this PR.

Comments

@mzdk100
Copy link

mzdk100 commented Oct 3, 2024

I used the following code:

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(asset_server: Res<AssetServer>, mut commands: Commands) {
    commands.spawn(AudioPlayer::<AudioSource>(
        asset_server.load("test.ogg"),
    ));
}

Directly debug and run without any problems, audio can be played normally:

cargo run --target aarch64-apple-darwin

However, if packaged in .app format (for distribution purposes), files in assets cannot be read and audio cannot be played.

[package.metadata.bundle]
name = "myapp"
identifier = "com.sscn.myapp"
icon = ["logo_32x32.png", "platform/macos/logo_128x128.png"]
resources = ["assets"]
copyright = "Copyright (C) 2024. All rights reserved."
category = "Game"
long_description = """
A role-playing card game.
cargo install cargo-bundle
cargo bundle --release --target aarch64-apple-darwin

How should I achieve it? Thank you.

@kristoff3r kristoff3r added O-MacOS Specific to the MacOS (Apple) desktop operating system A-Assets Load files from disk to use for things like images, models, and sounds labels Oct 3, 2024
@BenjaminBrienen BenjaminBrienen added the S-Needs-Help The author needs help finishing this PR. label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds O-MacOS Specific to the MacOS (Apple) desktop operating system S-Needs-Help The author needs help finishing this PR.
Projects
None yet
Development

No branches or pull requests

3 participants