MrGVSV / bevy_proto

Create config files for entities in Bevy
Other
239 stars 25 forks source link

Added ability to load prototypes recursively #6

Closed edouardpoitras closed 2 years ago

edouardpoitras commented 2 years ago

Not sure this PR is the cleanest way of doing it, but I needed that capability and it works on my end. Please provide feedback and request changes as needed.

edouardpoitras commented 2 years ago

A few things maybe worth discussing: 1) Should we put a recursive depth limit? 2) I didn't bump the version - maybe worth going to 0.2.1? 3) A better/cleaner approach that I didn't think of? 4) Adding a parameter to with_dir/with_dirs instead of the two new variants with_dir_recursive/with_dirs_recursive? This would mean breaking backwards compatibility though.

MrGVSV commented 2 years ago
  1. Should we put a recursive depth limit?

I don't think so. It could result in undefined behavior (unless we allow them to set the limit themselves, in which case, recursive_loading should probably be replaced with an Option<u8>).

  1. I didn't bump the version - maybe worth going to 0.2.1?

Yeah, I'll bump and publish. Hoping to work on a version 0.3 release for Bevy 0.6 soon.

  1. A better/cleaner approach that I didn't think of?

I find this approach pretty clean myself. If you want to add the recursion limit, that would be nice as well, but not super necessary at the moment.

  1. Adding a parameter to with_dir/with_dirs instead of the two new variants with_dir_recursive/with_dirs_recursive? This would mean breaking backwards compatibility though.

I'm okay with the methods. I'd rather not add parameters to the others if we can help it (especially if those values are always typically going to be true or false, depending on the user's preference).

edouardpoitras commented 2 years ago

Great! Thanks.