Assets fail to load in a multi-module project
See original GitHub issueHi, I run into the following problem when running the demo based on https://github.com/AlmasB/FXGL/wiki/Adding-Images-and-Sounds :
12:03:59.131 [JavaFX Application Thread] FATAL AssetLoader - Loading failed for asset: drop.wav. Cause: Unrecognized file signature! 12:03:59.131 [JavaFX Application Thread] FATAL GameApplication - Uncaught Exception: 12:03:59.132 [JavaFX Application Thread] FATAL GameApplication -
Exception occurred: java.lang.IllegalArgumentException : Failed to load asset: drop.wav. Cause: Unrecognized file signature! E: com.almasb.fxgl.asset.AssetLoader.loadFailed(AssetLoader.kt:652) E: com.almasb.fxgl.asset.AssetLoader.loadSound(AssetLoader.kt:216) E: com.almasb.fxgl.audio.AudioPlayer.playSound(AudioPlayer.kt:114) E: FXGLBasicGameApp.lambda$0(FXGLBasicGameApp.java:103)
Both drop.wav and brick.png won’t load.
In my project, I leave the demo class file within a maven package. The AssetLoader has trouble looking for my resources folder (let alone the textures and sounds within).
I’ve tried using getResource() to get the relative path
String path = this.getClass().getResource("../../assets/textures/brick.png").toExternalForm();
but AssetLoader doesn’t understand it.
Is there a way to load assets from resources in this case ?
Thanks much for any insight and keep up the good work !
Issue Analytics
- State:
- Created 6 years ago
- Comments:28 (16 by maintainers)
Top GitHub Comments
Thanks for your help in debugging the cause. What a great thing you are doing in improving and putting together the best of all other open source game engines out there !
That’s indeed curious. Anyway, if you think the problem’s been solved feel free to close the issue. Also, let me know how you get on with your project or if you have any other questions