I am using the Rust Amethyst game engine to load a texture named ground.png
, but the Loader
does not seem to find the file:
//...
let assets_dir = format!("{}", env!("CARGO_MANIFEST_DIR"));
let mut game = Application::build(assets_dir, Example)?.build(game_data)?;
My assets_dir
is the root folder of the project and when loading my file, I append textures/ground.png
:
let texture_handle = {
let loader = world.read_resource::<Loader>();
let texture_storage = world.read_resource::<AssetStorage<Texture>>();
loader.load(
"textures/ground.png",
PngFormat,
Default::default(),
(),
&texture_storage,
)
};
My file directory looks like this:
├── src
│ └── main.rs
├── Cargo.toml
└── textures
└── ground.png
The error I am getting is a None
value when fetching the texture:
assert!(
world
.read_resource::<AssetStorage<Texture>>()
.get(&texture_handle) != None
); //panics
I am using amethyst 0.8.