Thanks to visit codestin.com
Credit goes to lib.rs

#drag-and-drop #bevy-plugin #web #panic #better

bevy_web_file_drop

Bevy plugin adding better support for drag and drop files in the web

10 releases

Uses new Rust 2024

0.2.2 Nov 25, 2025
0.2.1 Nov 25, 2025
0.1.0 Jun 20, 2025
0.0.6 Aug 20, 2024
0.0.2 Jan 3, 2024

#1056 in Game dev

MIT/Apache

43KB
71 lines

Bevy plugin adding better support for drag and drop files in the web. Bevy has built in drag and drop support, but when used in a web build they cause a panic and don't cancel the default browser behaviors. This plugin adds some custom JavaScript glue around the canvas to catch these events and relay them safely to Bevy.

Usage

After adding the plugin, you can use the same Bevy FileDragAndDrop events to read dropped files. The only difference is that the path_buf field of the DroppedFile event will be a blob URL instead of a local file path. This blob URL will be loadable as a Bevy asset using bevy_blob_loader.

You might not have to change any code at all! Just add in the plugin and dropped files should work in both native and web builds.


bevy_web_file_drop

Bevy plugin adding better support for drag and drop files in the web. Bevy has built in drag and drop events, but they cause a panic when used in a web build and don't cancel the default browser behavior. This plugin adds some custom JavaScript glue around the canvas to catch these events and relay them to Bevy.

Dependencies

~27–43MB
~708K SLoC