How can I store KeyCode in scenes? #1334
Unanswered
Florian0305
asked this question in
Q&A
Replies: 1 comment 5 replies
-
Hmm, maybe you'd be interested in this crate: https://crates.io/crates/kurinji? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone 😄
I'm a beginner in programming, I've been learning Rust and Bevy by myself, and i'm still learning some basics, sorry for any mistakes.
I'm currently trying to store data thanks to Bevy scenes in my video game and I have some trouble storing KeyCode.
I succeeded loading String values in-game with a scene, changing the value of this String in-game, and then storing it in my scene for the next launch.
I used a component like this in order to do it:
My goal is to store KeyCodes and not Strings, in order to save the player's settings (example: move_right: KeyCode::D)
So I changed my structure's attributes's type from String to KeyCode. I thought that everything would have worked, but now my #[derive(Reflect)], which allows serialization, deserialization etc does not work and I can't save or load KeyCodes.
Did I miss something? Is it even possible to use KeyCode in scenes? Do I have to implement the way it should behave?
I really tried for hours to understand what is the problem but I can't figure it out 😞, and I've looked at all examples done with Bevy but I still did not succeed with my basic knowledge. I'm really opened to any suggestions ! 😄
Beta Was this translation helpful? Give feedback.
All reactions