-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Assets not loading for compiled binaries #344
Comments
I am unable to reproduce this issue (running macOS 10.14.2). I did cargo run and it worked. Then, I copied the compiled binary into the project directory and it still worked. Finally, I tried just copying the binary and the assets folder into a separate directory and ran it. It did not work when I ran it from outside that directory, but it did work when I ran it from within that directory. What is happening in my case is that the binary attempts to access the relative path from the working directory that the binary was called from, not necessarily where the binary is located. That would explain why Could this be what is going on? |
@Xavientois thanks :) Also while moving assets from folder to folder or specifying direct path worked for macOS, it didn't work for iOS. Maybe it's |
Updated description with more info and logs. |
Adding |
Running from console works as expected, in that assets are relative to the current working directory. It might be nice to be able to provide a Packaged games is a different matter... on windows with your installer you could just setup the shortcut with the correct working directory. I don't know how to make a mac I suppose that iOS is special here in that the development build setup is already the packaged build. |
Stumbled across this https://agmprojects.com/blog/packaging-a-game-for-windows-mac-and-linux-with-rust Sounds like you are on to something with the Perhaps the answer is per-OS config switch or different config when bundling to set the asset base path? |
I am also having this issue but on windows 10. Cargo run works perfectly in all the examples however I am having issues with cargo build (and cargo build --release). Some of the compiled binaries such as 3d_scene and spawner do load assets correctly but the 2d ones like sprite do not. |
|
Ah okay! haha, should have realized that tbh! Cheers!
No unfortunately not. Using |
If you use |
Thank you @naithar that worked. |
Fixed by #693 |
For anyone else that stumbles upon this in future and is interested in the link (even if it's not needed for Bevy anymore), then this is a fixed link (as at today, at least; the original is missing |
Platform:
macOS 10.15.4 and iOS 13.6 (as part of #87)
Description:
While testing sprite sample I've encountered an issue running a compiled (not
cargo run
) binary.Both macOS and iOS didn't show sprite if binary was run directly even if asset folder was next to binary.
Changing relative (?) path to full path using
std::env::current_exe()
fixed the issue for macOS, but didn't work for iOS.Edit:
Running binary on macOS from console fixes the issue.
Running binary by double clicking on it does not. Placing assets at
~
directory fixes the issue.Making an
.app
package and running it also results in empty scene.Console output for
std::env::current_dir()
andstd::env::current_exe()
:Running in console (works out of the box):
Running by double clicking (requires moving
assets
to HOME folder):.app
package (specifying full path worked):iOS application (
specifying full path didn't workloading by full path seems to be working, but it's not displayed due to some other problem):load
returns correct texture handle all the time, even if there is nothing to load.The text was updated successfully, but these errors were encountered: