You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For most random number generation needs, people simply grab the latest version of the rand crate. For this to work on WASM, upstream (for reasons I don't understand) ditched their WASM feature flag and now expect you to override their dependency manually and toggle the feature flag yourself, as mentioned rather obscurely upstream here:
Except in the case of Bevy 0.4 this doesn't actually work because bevy_ecs depends on rand 0.7 which depends on getrandom 0.1. So people get a thread_rng or similar panic in the browser and are none the wiser despite following upstream instructions. Figuring this out is pretty painful. This actually does work:
This specific issue no longer occurs with Bevy 0.5 due to bevy_ecs now also depending on rand 0.8. However, this will potentially still cause problems in the future. If rand releases version 0.9 tomorrow and people start using it, the same problem will occur until Bevy catches up. Of course this is not a bug in Bevy itself, and it's not like there is no fix. But it's easy to run into this problem unknowingly and difficult enough to troubleshoot that I think it's worth highlighting here. Not to mention that having to care about a dependency of a dependency is uninuitive at best.
When it was discussed on Discord, the consensus was to take this up with the maintainers of rand. I'll leave this open for a bit for people to chime in, after which it can perhaps function as a tracking issue if it needs escalating upstream.
The text was updated successfully, but these errors were encountered:
For most random number generation needs, people simply grab the latest version of the
rand
crate. For this to work on WASM, upstream (for reasons I don't understand) ditched their WASM feature flag and now expect you to override their dependency manually and toggle the feature flag yourself, as mentioned rather obscurely upstream here:Except in the case of Bevy 0.4 this doesn't actually work because
bevy_ecs
depends onrand
0.7 which depends ongetrandom
0.1. So people get a thread_rng or similar panic in the browser and are none the wiser despite following upstream instructions. Figuring this out is pretty painful. This actually does work:This specific issue no longer occurs with Bevy 0.5 due to
bevy_ecs
now also depending onrand
0.8. However, this will potentially still cause problems in the future. Ifrand
releases version 0.9 tomorrow and people start using it, the same problem will occur until Bevy catches up. Of course this is not a bug in Bevy itself, and it's not like there is no fix. But it's easy to run into this problem unknowingly and difficult enough to troubleshoot that I think it's worth highlighting here. Not to mention that having to care about a dependency of a dependency is uninuitive at best.When it was discussed on Discord, the consensus was to take this up with the maintainers of
rand
. I'll leave this open for a bit for people to chime in, after which it can perhaps function as a tracking issue if it needs escalating upstream.The text was updated successfully, but these errors were encountered: